Repository navigation
fix: align nested piecewise merge join sorting and comparison - #26043
mikamikasuki wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26043 +/- ##
==========================================
- Coverage 82.66% 82.66% -0.01%
==========================================
Files 1147 1147
Lines 446357 446395 +38
Branches 446357 446395 +38
==========================================
+ Hits 368971 369002 +31
- Misses 54997 55001 +4
- Partials 22389 22392 +3 ☔ 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:
|
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.