refactor: Update SortMergeJoin to use async spill abstractions and remove open_sync#22230
Draft
pantShrey wants to merge 1 commit into
Draft
refactor: Update SortMergeJoin to use async spill abstractions and remove open_sync#22230pantShrey wants to merge 1 commit into
pantShrey wants to merge 1 commit into
Conversation
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.
Note: This PR depends on #21882 (pluggable SpillFile trait) and cannot be merged before it. Opening in parallel per @alamb's suggestion for easier review. The required SpillFile trait used here is defined in that base PR.To review locally, apply #21882 first and then stack this branch on top.
Which issue does this PR close?
Rationale for this change
materializing_stream.rsandbitwise_stream.rswere reading spilled batches viaopen_sync_reader/ directFile::opencalls, bypassing theSpillFileabstraction introduced in #21882. This PR migrates both to useSpillManager::read_spill_as_stream, allowing custom backends (Postgres BufFile, object storage) to handle spill reads without requiring an OS file path.What changes are included in this PR?
materializing_stream.rs: Eagerly restores spilledBufferedBatchesvia async streams before freezing, avoiding new state machine variants.bitwise_stream.rs: Replaces sync reads with an asyncpoll_next_unpinloop, caching the stream to survivePoll::Pending.spill_file.rs: Removesopen_sync_readerfrom theSpillFiletrait (no longer needed).Are these changes tested?
Covered by existing SMJ tests. No new tests added, the behavioral change is internal (sync → async IO path), observable only through custom backends which are not yet in tree.
Are there any user-facing changes?
No. Removes
open_sync_readerfrom the SpillFile trait, this is a breaking API change for anyone implementing the trait, but the trait was introduced in #21882 which has not merged yet so there are no external implementors.