Skip to main content

Your First PR for Databend

Databend is an open-source project where everyone can contribute their code and make their creative ideas into a reality. This topic helps new contributors understand how to create a pull request for Databend on GitHub and provides useful considerations for code contributions.

tip

Did You Know? To show our appreciation, your GitHub username will be added to the table system.contributors after your code is successfully merged.

Check it out:

SELECT * FROM system.contributors

Prerequisites

Databend is written in Rust, to build Databend from scratch you will need to install the following tools:

  • Git
  • Rust Install with rustup

Coding Guidelines

Code Format and Analysis

$ make lint

Code Documentation

Any public fields, functions, and methods should be documented with Rustdoc.

Please follow the conventions as detailed below for modules, structs, enums, and functions. The single line is used as a preview when navigating Rustdoc. As an example, see the 'Structs' and 'Enums' sections in the collections Rustdoc.

/// [Single line] One line summary description
///
/// [Longer description] Multiple lines, inline code
/// examples, invariants, purpose, usage, etc.
[Attributes] If attributes exist, add after Rustdoc

Example below:

/// Represents (x, y) of a 2-dimensional grid
///
/// A line is defined by 2 instances.
/// A plane is defined by 3 instances.
#[repr(C)]
struct Point {
x: i32,
y: i32,
}

Contributing Documentation

We welcome you to contribute to the Databend documentation, alongside your code! The Databend documentation is composed of markdown files, which makes it easy to write and maintain. To ensure high-quality documentation, we recommend using Visual Studio Code as your markdown editor. Additionally, installing the Code Spell Checker extension will help you catch any spelling mistakes.

When submitting a document for a new command or function, it is crucial to adhere to the provided templates and guidelines to maintain consistency and ensure clarity in the Databend documentation. These templates are designed to include all the necessary information and formatting conventions, making it easier for users to understand and use the commands or functions.

In addition to following the templates, please pay attention to the code included within them. The code serves the purpose of explicitly indicating whether the new command or function is exclusively available for Databend Enterprise and provides information about when the command or function was introduced. This contextual information is crucial for users as it allows them to accurately assess the scope and limitations of the feature. It also enables users to identify the specific versions of Databend that support the feature, enabling them to plan their usage effectively.

Pull Requests

Submit a PR

  1. Fork the databend repo and create your branch from main.
  2. Open a regular issue for binding the pull request.
  3. Submit a Draft Pull Requests, tag your work in progress.
  4. If you have added code that should be tested, add unit tests.
  5. Verify and ensure that the test suites passes, make test.
  6. Make sure your code passes both linters, make lint.
  7. Change the status to "Ready for review".
  8. Watch out the replies from the @mergify, she will be your guide.

PR Title

Format: <type>(<scope>): <subject>

<scope> is optional

fix(query): fix group by string bug
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: rfc, feat, fix, refactor, ci, docs, chore

More types:

  • rfc: this PR proposes a new RFC
  • feat: this PR introduces a new feature to the codebase
  • fix: this PR patches a bug in codebase
  • refactor: this PR changes the code base without new features or bugfix
  • ci: this PR changes build/ci steps
  • docs: this PR changes the documents or websites
  • chore: this PR only has small changes that no need to record, like coding styles.

PR Template

Databend has a Pull Request Template:

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla

## Summary

Summary about this PR

Fixes #issue

You should not change the PR template context, but need to finish:

  • Summary - Describes what constitutes the Pull Request and what changes you have made to the code. For example, fixes which issue.

Testing

Unit tests

$ make unit-test

Stateless tests

$ make stateless-test

Issues

Databend uses GitHub issues to track bugs. Please include necessary information and instructions to reproduce your issue.

Documentation

All developer documentation is published on the Databend developer site, databend.com.

Code of Conduct

Please refer to the Code of Conduct, which describes the expectations for interactions within the community.