docs/source/contributor-guide/pr_review.md
When reviewing PRs, our primary goal is to improve DataFusion and its community together. PR feedback should be constructive and help improve the code as well as the understanding of the contributor.
Review bandwidth is currently our most limited resource, and reviews from the broader community are both welcomed and encouraged. Reviewing PRs is a great way to learn the codebase, and you do not need to be a committer to leave valuable review feedback. In fact, one of the best ways to become a committer is to thoughtfully review other PRs.
Please ensure any comments you leave contain a rationale and suggested alternative -- it is frustrating to be told "don't do it this way" without any clear reason or alternative provided.
The criteria in this guide are also a useful checklist when preparing your own PR for review.
Some helpful links:
The overall PR lifecycle (CI triggering, approval, the 24-hour rule for "major" PRs, and merging) is described in the Pull Request Overview section of the contributor guide.
Practical tips:
gh pr checkout <PR number> using the GitHub CLI.The PR description is often what users and contributors will find when they have a question about the intention behind a change, or when the code itself is not clear. The PR description also becomes the extended commit message.
Check that the description:
Concisely describes the problem being solved from the user's point of view.
Follows the PR template, and answers the template's questions.
Accurately describes the content of the PR, including any relevant context or background. Great descriptions have a high signal-to-noise ratio, summarizing important implementation changes without repeating technical minutiae that are already present in the code itself.
Explicitly calls out any user-facing or API changes (see Review the Code below).
The goal of code comments is to help future readers of the code understand what is not obvious from reading the code itself. Great comments make the code easier to reason about for readers with the expected background, and help future maintainers.
Some practical guidelines for reviewing comments:
[`SessionContext`]) rather than plain
text names, so that cargo doc link checking ensures the references stay
valid as the code evolves.Check that the feature or fix is covered sufficiently with tests (see the Testing guide for more details): the PR should include tests for any new functionality, and a bug fix should include a test that reproduces the reported problem.
Guidelines for evaluating tests:
sqllogictest (.slt) tests or DataFrame API tests where
possible, as they exercise user-visible behavior and are less coupled
to internal implementation details than unit tests.codecov check on the PR,
or by running cargo llvm-cov locally for an HTML report. Use judgment
about any uncovered lines -- the goal is confidence in the change, not
slavishly hitting some coverage number.insta snapshots or .slt expected output) rather than merely checking
"no error occurred".Check that:
plan_err! for user-triggerable errors vs
internal_err! for invariant violations).Performance is a key feature of DataFusion. See Performance Improvements for the project policy: an improvement should be "enough" to justify any added code complexity, and performance PRs should come with benchmark results.
When reviewing:
main:
the system-level SQL benchmarks are run with bench.sh (see the
benchmarks README), and microbenchmarks (e.g. in
datafusion/functions/benches) are run with cargo bench.Here are some suggested best practices to follow when reviewing PRs.
Open reviews by thanking the author by name, and when a PR is well done, say specifically what makes it good -- positive feedback encourages people to keep contributing and helps them understand what is valued in the project.
If you are not ready to approve, list concretely what you would need to see before approving (e.g. "benchmark results and an upgrade guide entry") so the author has a clear path to merge.
Explicitly defer non-critical suggestions to a follow-on PR and file (or ask the author to file) issues for them, so good PRs merge quickly without scope creep.
Similarly, when a PR mixes refactoring with behavior changes or fixes a narrow problem with a broad mechanism, ask for it to be split or scoped down rather than reviewing it as-is.
Rather than a bare "LGTM", say what you actually checked ("traced the state transitions by hand", "confirmed the hasher change cannot affect ordering") so it is clear what was verified and what was not.
For changes to core, widely shared code, leave the PR open for other committers to look at and cc those who know the area, even after you have approved.