feat(sort-shuffle): accept Option<Partitioning>#1638
Draft
andygrove wants to merge 4 commits intoapache:mainfrom
Draft
feat(sort-shuffle): accept Option<Partitioning>#1638andygrove wants to merge 4 commits intoapache:mainfrom
andygrove wants to merge 4 commits intoapache:mainfrom
Conversation
87b92a5 to
3f21142
Compare
…itioning When `SortShuffleWriterExec` was constructed with `partitioning=None` every task wrote `partition_id=0` to the scheduler, so the scheduler's partition_locations map collapsed all 16 hash buckets from the upstream stage under a single key. The downstream `SortPreservingMergeExec` then saw one stream containing 16 sorted sub-streams concatenated together, which is not globally sorted, and produced rows out of order. Fix matches legacy `ShuffleWriterExec` semantics: report `partition_id = input_partition` so each input task lands in its own output slot. The on-disk file still has a single logical bucket (bucket 0); both the local and Flight readers now map any request on a single-bucket file to bucket 0. Also update test expectations that still referenced `ShuffleWriterExec` for the final stage now that None-partitioning is routed through sort-shuffle.
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?
Closes #.
Rationale for this change
SortShuffleWriterExecpreviously only supportedPartitioning::Hash. Stages withpartitioning=None(final output,CoalescePartitionsExec,SortPreservingMergeExec) had to fall back toShuffleWriterExec, leaving two writer code paths and two on-disk shuffle formats coexisting in executor work directories. Extending sort-shuffle to handleNonelets every stage use one writer when sort-based shuffle is enabled and is a prerequisite for removing the legacy hash-based writer entirely.What changes are included in this PR?
SortShuffleWriterExec::try_newnow takesOption<Partitioning>(mirroringShuffleWriterExec). WhenNone, the writer skips hashing and writes a single-partition data+index file with every input row in bucket 0.shuffle_output_partitioning()returnsOption<&Partitioning>.ballista_core::serdeaccept the absentoutput_partitioningfield onSortShuffleWriterExecNode(the proto field is implicitly optional, so no proto change).DefaultDistributedPlanner::create_shuffle_writer_with_configselects sort-shuffle for any supported partitioning (HashorNone) whenBALLISTA_SHUFFLE_SORT_BASED_ENABLEDis on, instead of falling back toShuffleWriterExec.Noneand the planner routing decision.Are there any user-facing changes?
The signature of
SortShuffleWriterExec::try_newandshuffle_output_partitioning()change shape (Partitioning->Option<Partitioning>). TheBALLISTA_SHUFFLE_SORT_BASED_ENABLEDconfig still controls the choice of writer; the difference is that when enabled, all stages use sort-shuffle, not just the hash-partitioned ones.