fix: keep every spilled slice of a sort-merge join inner key group - #24056
Open
buraksenn wants to merge 3 commits into
Open
fix: keep every spilled slice of a sort-merge join inner key group#24056buraksenn wants to merge 3 commits into
buraksenn wants to merge 3 commits into
Conversation
BitwiseSortMergeJoinStream kept only a single finished spill file per inner key group. When one group spanned several inner batches and the memory reservation failed more than once, each new spill replaced the previous file, silently dropping its rows: semi joins lost matches, anti joins returned extra rows, and mark joins produced wrong marks under memory pressure. Keep one InProgressSpillFile open per key group instead: every overflow appends the freshly buffered slices to the same file, and the writer is finalized for read-back when evaluation of the group starts (buffering is complete by then). A group therefore produces exactly one spill file that holds all of its spilled rows.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24056 +/- ##
==========================================
- Coverage 80.86% 80.86% -0.01%
==========================================
Files 1101 1101
Lines 375446 375455 +9
Branches 375446 375455 +9
==========================================
+ Hits 303592 303594 +2
- Misses 53761 53765 +4
- Partials 18093 18096 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kumarUjjawal
approved these changes
Aug 3, 2026
kumarUjjawal
left a comment
Contributor
There was a problem hiding this comment.
Thank you @buraksenn
Looks good!
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 3, 2026
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
Filtered semi, anti, and mark sort-merge joins kept only one finished spill file per inner key group. If a group spilled more than once, each spill replaced the previous file, so read-back could lose earlier rows and produce incorrect results.
What changes are included in this PR?
Keep one
InProgressSpillFileopen per inner key group, append every overflow to it, and finalize it before filter evaluation.Are these changes tested?
Yes:
Are there any user-facing changes?
no