Repository navigation
fix: align nested piecewise merge join sorting and comparison - #26043
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #26043 +/- ##
=======================================
Coverage 82.74% 82.74%
=======================================
Files 1147 1147
Lines 449767 449824 +57
Branches 449767 449824 +57
=======================================
+ Hits 372160 372211 +51
- Misses 54938 54939 +1
- Partials 22669 22674 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the fix. The root cause seem to be sorting and comparison don't agree in PWMJ, is it possible to fix that directly? If that's tricky, this PR's approach totally makes sense, but we would keep the issue open, and add a note for the remaining fix to the root cause. |
|
@mikamikasuki Would you like to rewrite this PR for the fix? I guess the gaps to the direct fix to the root cause are:
They could be the follow-up if you want, change Close to Part of in the description |
|
Thanks for pointing out these gaps. I’ve updated this PR to fix the ordering/comparison mismatch directly:
|
|
I think it is ready to go, thanks @mikamikasuki @2010YOUY01 |
|
@mikamikasuki , you don't need to merge main branch |
Got it, thanks for the clarification! I clicked the update button unnecessarily. I'll leave the branch as is and avoid merging main again. |
Which issue does this PR close?
Rationale for this change
Piecewise merge joins can return incorrect results for nested range keys containing inner NULLs, and fail when sorting Struct or List-of-List keys. Sorting, extreme-key selection, and comparison must use the same ordering.
What changes are included in this PR?
</<=keys descending with NULLs last, reversing both value and inner-NULL ordering to agree with SQL comparisons.lexsort_to_indices, supporting Struct and List-of-List keys.PiecewiseMergeJoinExec.What is the testing strategy for this PR?
SQL logic tests compare complete result multisets against NestedLoopJoin for List, Struct, and List-of-List keys, all four range operators, classic joins, semi/anti joins, and an EXISTS mark expression. The matrix covers batch sizes 1, 2, and 8192 and partition counts 1 and 4. Plan assertions check that Struct and List-of-List classic joins use PWMJ.
Validation passed: PWMJ SQL logic tests and fuzz tests, the extended workspace suite (including all 527 SQL test files), formatting, Clippy with all targets/features, and the repository lint checks.
Are there any user-facing changes?
Nested range joins produce correct results and support Struct and List-of-List keys with piecewise merge joins enabled. No public API changes.