Repository navigation
refactor: remove redundant join-flattening precheck - #25685
Merged
neilconway merged 3 commits intoSep 24, 2026
Merged
Conversation
Remove the always-successful precheck at the inner-join entry points and make flatten_join_inputs infallible. Preserve outer join boundaries and filter collection, with a focused plan regression test. Fix two existing benchmark Clippy warnings required by local checks. Refs apache#25680
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25685 +/- ##
==========================================
- Coverage 82.50% 82.50% -0.01%
==========================================
Files 1140 1140
Lines 438050 438062 +12
Branches 438050 438062 +12
==========================================
- Hits 361415 361407 -8
- Misses 54829 54841 +12
- Partials 21806 21814 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jayzhan211
self-requested a review
September 24, 2026 13:06
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 24, 2026
neilconway
approved these changes
Sep 24, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 24, 2026
neilconway
enabled auto-merge
September 24, 2026 15:13
diegoQuinas
pushed a commit
to diegoQuinas/datafusion
that referenced
this pull request
Sep 24, 2026
## Which issue does this PR close? Closes apache#25680. ## Rationale for this change `EliminateCrossJoin` walks the inner-join subtree twice before rebuilding it. Both callers of `can_flatten_join_inputs` already establish an inner-join root, and the helper only recurses into inner-join children, so the precheck always succeeds at these call sites. Removing it avoids the redundant traversal and the need to keep two traversal implementations in sync, while preserving the existing optimized plans. ## What changes are included in this PR? - Remove `can_flatten_join_inputs` and its two call-site guards. - Make the private `flatten_join_inputs` helper infallible and update its documentation. Keep filter collection, non-inner join boundaries, and child/subquery rewriting unchanged. - Add a focused plan test for preserving a left-join subtree and its filter beneath an inner join, including the inner join's residual filter and output schema. - Fix two existing Clippy warnings in `multi_group_by.rs` to pass the required local checks. ## What is the testing strategy for this PR? - All 26 `eliminate_cross_join` tests passed, including `preserve_outer_join_boundary`. - Extended workspace tests passed: 12,112 tests passed, 8 ignored, and all 523 sqllogictest files completed successfully. - `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D warnings`, and `uv run ./dev/rust_lint.sh` passed. - Compared the existing six-table self-join and no-join SQL planning workloads against `main` using a temporary Criterion harness. Across three alternating rounds, physical plans matched and no consistent end-to-end speedup was observed; six-table planning stayed around 4.9 ms. This is a maintainability refactor without a measured performance improvement claim. ## Are there any user-facing changes? No SQL behavior or public API changes. Co-authored-by: Neil Conway <neil.conway@gmail.com>
Omega359
pushed a commit
to Omega359/arrow-datafusion
that referenced
this pull request
Oct 11, 2026
## Which issue does this PR close? Closes apache#25680. ## Rationale for this change `EliminateCrossJoin` walks the inner-join subtree twice before rebuilding it. Both callers of `can_flatten_join_inputs` already establish an inner-join root, and the helper only recurses into inner-join children, so the precheck always succeeds at these call sites. Removing it avoids the redundant traversal and the need to keep two traversal implementations in sync, while preserving the existing optimized plans. ## What changes are included in this PR? - Remove `can_flatten_join_inputs` and its two call-site guards. - Make the private `flatten_join_inputs` helper infallible and update its documentation. Keep filter collection, non-inner join boundaries, and child/subquery rewriting unchanged. - Add a focused plan test for preserving a left-join subtree and its filter beneath an inner join, including the inner join's residual filter and output schema. - Fix two existing Clippy warnings in `multi_group_by.rs` to pass the required local checks. ## What is the testing strategy for this PR? - All 26 `eliminate_cross_join` tests passed, including `preserve_outer_join_boundary`. - Extended workspace tests passed: 12,112 tests passed, 8 ignored, and all 523 sqllogictest files completed successfully. - `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D warnings`, and `uv run ./dev/rust_lint.sh` passed. - Compared the existing six-table self-join and no-join SQL planning workloads against `main` using a temporary Criterion harness. Across three alternating rounds, physical plans matched and no consistent end-to-end speedup was observed; six-table planning stayed around 4.9 ms. This is a maintainability refactor without a measured performance improvement claim. ## Are there any user-facing changes? No SQL behavior or public API changes. Co-authored-by: Neil Conway <neil.conway@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #25680.
Rationale for this change
EliminateCrossJoinwalks the inner-join subtree twice before rebuilding it. Both callers ofcan_flatten_join_inputsalready establish an inner-join root, and the helper only recurses into inner-join children, so the precheck always succeeds at these call sites.Removing it avoids the redundant traversal and the need to keep two traversal implementations in sync, while preserving the existing optimized plans.
What changes are included in this PR?
can_flatten_join_inputsand its two call-site guards.flatten_join_inputshelper infallible and update its documentation. Keep filter collection, non-inner join boundaries, and child/subquery rewriting unchanged.multi_group_by.rsto pass the required local checks.What is the testing strategy for this PR?
eliminate_cross_jointests passed, includingpreserve_outer_join_boundary.cargo fmt --all,cargo clippy --all-targets --all-features -- -D warnings, anduv run ./dev/rust_lint.shpassed.mainusing a temporary Criterion harness. Across three alternating rounds, physical plans matched and no consistent end-to-end speedup was observed; six-table planning stayed around 4.9 ms. This is a maintainability refactor without a measured performance improvement claim.Are there any user-facing changes?
No SQL behavior or public API changes.