perf: mirror compound ASOF key predicates to right - #25728
Merged
jayzhan211 merged 10 commits intoOct 1, 2026
Merged
Conversation
…r-mirroring # Conflicts: # benchmarks/sql_benchmarks/asof_join/asof_join.suite # datafusion/optimizer/src/push_down_filter.rs # datafusion/sqllogictest/test_files/asof_join.slt
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25728 +/- ##
==========================================
- Coverage 82.58% 82.58% -0.01%
==========================================
Files 1145 1145
Lines 443657 443651 -6
Branches 443657 443651 -6
==========================================
- Hits 366396 366383 -13
- Misses 55011 55017 +6
- Partials 22250 22251 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…cate-mirroring # Conflicts: # benchmarks/sql_benchmarks/asof_join/asof_join.suite # datafusion/optimizer/src/push_down_filter.rs # datafusion/sqllogictest/test_files/asof_join.slt
Xuanwo
marked this pull request as ready for review
September 26, 2026 18:07
Member
Author
|
Hi @jayzhan211 and @2010YOUY01, #25574 has merged, so I merged the latest main into this follow-up and marked it ready. Could you take a look when you have time? Thanks! |
Member
Author
|
Let's merge this PR in 😄 ! |
jayzhan211
enabled auto-merge
September 30, 2026 14:01
jayzhan211
disabled auto-merge
October 1, 2026 12:18
jayzhan211
enabled auto-merge
October 1, 2026 12:18
Contributor
|
Couldn't merge 🤔 re-trigger the CI |
Contributor
If there is a new CI job added in (And thanks for the great work on another improvement!) |
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?
Rationale for this change
#25574 mirrors a selective
left_key = literalfilter to the right side of an ASOF join. The same equality guarantee applies to any deterministic predicate that references only direct left equality-key columns, includingIN, ranges, andORexpressions. Mirroring those predicates avoids sorting and broadcasting right-side groups that cannot match a surviving left row.Performance
Q10 has 50M rows on each side across 500K equality groups.
WHERE l.key IN (42, 43)retains two groups and produces 200 rows with both revisions. On an Apple M4 Max, using independent release builds and two 7-iteration runs per revision, the median elapsed time across all 14 iterations was:acf5c89e6)5763d505a)This selective compound-key workload is about 12.0x faster (91.6% lower elapsed time). The benchmark file and command were the same for both binaries:
What changes are included in this PR?
IN, range, andORpredicates while leaving mixed key/non-key predicates entirely off the right input.Coerced and expression-based equality keys remain excluded because they cannot be replaced column-for-column.
What is the testing strategy for this PR?
The new
asof_join.sltcases verify compound predicate mirroring and the all-or-nothing behavior for a mixed key/non-keyORpredicate. Q10 covers the user-visible selective workload.Also run:
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsAre there any user-facing changes?
No API or result changes. More eligible ASOF joins can sort and retain fewer right-side rows.