[SPARK-56023][SS] Better load balance in LowLatencyMemoryStream#54848
Open
eason-yuchen-liu wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-56023][SS] Better load balance in LowLatencyMemoryStream#54848eason-yuchen-liu wants to merge 1 commit intoapache:masterfrom
eason-yuchen-liu wants to merge 1 commit intoapache:masterfrom
Conversation
HeartSaVioR
reviewed
Mar 18, 2026
| val partitionId = index % numPartitions | ||
| records(partitionId) += ((toRow(item).copy().asInstanceOf[UnsafeRow], timestamp)) | ||
| data.iterator.foreach { item => | ||
| val partitionId = records.size % numPartitions |
Contributor
There was a problem hiding this comment.
How this works? records.size will be always the same (= numPartitions) regardless of how the events are currently distributed, right? This change will simply put the data in a single partition, the first partition.
While we are here, I'd love to see the test at this point.
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.
What changes were proposed in this pull request?
Rewrite
addDatato userecords.size % numPartitionsfor better load balance across partitions.Why are the changes needed?
Previously, it will only load balance across partitions when a sequence of data is input altogether. This change enables load balance for one-row-at-a-time input patterns.
Does this PR introduce any user-facing change?
No. This is a test only source.
How was this patch tested?
CI.
Was this patch authored or co-authored using generative AI tooling?
No.