feat: support ASOF JOIN SQL - #23830
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #23830 +/- ##
==========================================
+ Coverage 81.57% 81.62% +0.04%
==========================================
Files 1123 1123
Lines 410789 411095 +306
Branches 410789 411095 +306
==========================================
+ Hits 335120 335536 +416
+ Misses 55913 55770 -143
- Partials 19756 19789 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dff33b2 to
fe21f45
Compare
fe21f45 to
c1f3e95
Compare
# Conflicts: # datafusion/expr/src/logical_plan/builder.rs # datafusion/expr/src/logical_plan/plan.rs
|
cc @2010YOUY01, this PR is good to go! 🚀 Also CC @jayzhan211: would you like to follow this stack's review? Happy to ping you if you're interested. 😄 |
Of course! |
jayzhan211
left a comment
There was a problem hiding this comment.
Thanks @Xuanwo Minor issues left, others LGTM
| let already_projected = select.already_projected(); | ||
| let left_plan = | ||
| Self::unwrap_qualified_passthrough_join_projection(Arc::clone(&join.left)); | ||
| let inline_left_join = matches!(left_plan.as_ref(), LogicalPlan::Join(_)); |
There was a problem hiding this comment.
Do we need asof join here
There was a problem hiding this comment.
Same with unwrap_qualified_passthrough_join_projection
| return Ok(None); | ||
| let join_plan = match plan { | ||
| LogicalPlan::Join(_) => plan, | ||
| LogicalPlan::Projection(projection) |
Which issue does this PR close?
Rationale for this change
This is the SQL frontend layer of the ASOF JOIN stack. It adds syntax and
unparsing on top of the merged physical and logical contracts. The PR now
contains only the isolated SQL frontend diff.
What changes are included in this PR?
ASOF JOIN ... MATCH_CONDITION (...)with optionalONorUSINGequality keys.
ONpredicates.nested join scope.
USINGkeys, left-partitioned broadcast execution, the full-right memoryrequirement, repeated scans, and the absence of spill/repartitioned ASOF.
coercion, equality-free joins, USING, invalid contracts, EXPLAIN, boundedness,
and optimized-plan round trips.
partitioning is preserved while the right input is single-partitioned.
Are these changes tested?
Yes:
cargo fmt --all./ci/scripts/doc_prettier_check.sh --write --allow-dirtycargo clippy --all-targets --all-features -- -D warningscargo test -p datafusion --test core_integration asof --all-featurescargo test -p datafusion-sqllogictest --test sqllogictests --all-features -- asof_joinAre there any user-facing changes?
Users can express Snowflake-style ASOF joins in SQL with
MATCH_CONDITION, optional equality keys, and<,<=,>, or>=matchdirections. With
USING, wildcard output exposes one unqualified key whileboth qualified input keys remain addressable. The user guide also documents
the initial broadcast strategy and its memory/no-spill limitations.
#23829 and #23828 are merged. This is the next core layer in the ASOF stack and
does not depend on the optional floating-point follow-up #24375.