-
Notifications
You must be signed in to change notification settings - Fork 299
feat: Add immediate mode option for native shuffle #3845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
andygrove
wants to merge
11
commits into
apache:main
Choose a base branch
from
andygrove:immediate-mode-partitioner
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9750b26
feat: add immediate mode option for native shuffle
andygrove c3dd880
refactor: extract shared partition ID computation to utility module
andygrove 514ecdb
chore: format README with prettier
andygrove 185794a
docs: fix tuning guide to accurately describe partitioner mode trade-…
andygrove d36e7ff
docs: more accurately describe memory trade-offs between partitioner …
andygrove 1922ffd
chore: cargo fmt
andygrove 23ac406
fix: resolve merge conflict in CometNativeShuffleWriter
andygrove 0f8fa11
fix: address PR review feedback
andygrove 9971bfb
merge apache/main
andygrove 08dcb6e
revert change to default codec in benchmark binary
andygrove c45b3e9
revert change to default codec in benchmark binary
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,22 @@ Comet provides a fully native shuffle implementation, which generally provides t | |
| supports `HashPartitioning`, `RangePartitioning` and `SinglePartitioning` but currently only supports primitive type | ||
| partitioning keys. Columns that are not partitioning keys may contain complex types like maps, structs, and arrays. | ||
|
|
||
| Native shuffle has two partitioner modes, configured via | ||
| `spark.comet.exec.shuffle.partitionerMode`: | ||
|
|
||
| - **`buffered`** (default): Buffers all input batches in memory, then uses `interleave` to produce | ||
| partitioned output one partition at a time. Only one partition's output batch is in memory at | ||
| a time during the write phase, so this mode scales well to large numbers of partitions (1000+). | ||
| The trade-off is that it must hold all input data in memory (or spill it) before writing begins. | ||
|
|
||
| - **`immediate`**: Partitions incoming batches immediately using per-partition Arrow array builders, | ||
| flushing compressed IPC blocks when they reach the target batch size. This avoids buffering the | ||
| entire input in memory. However, because it maintains builders for all partitions simultaneously | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Above you say it's "Proportional to |
||
| (proportional to `num_partitions × num_columns × batch_size_in_rows`), memory overhead grows | ||
| with partition count. Data skew can also increase memory usage, since partitions receiving more | ||
| rows accumulate larger IPC buffers before spilling. For workloads with many partitions (1000+), | ||
| `buffered` mode is recommended. | ||
|
|
||
| #### Columnar (JVM) Shuffle | ||
|
|
||
| Comet Columnar shuffle is JVM-based and supports `HashPartitioning`, `RoundRobinPartitioning`, `RangePartitioning`, and | ||
|
|
||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current IPC writer uses block compression (compressing each batch), which may lead to poor compression ratios. In gluten, the shuffle writer first serializes and buffers the batches, then performs streming compression during eviction, achieving better compression ratios. I'm not entirely sure which is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've been experimenting with switching to IPC stream approach. I have a draft PR open for this, but it is not fully working yet.