Repository navigation
fix(arrow): keep first-occurrence order in RecordBatchPartitionSplitter::split - #3754
Open
CaptainAni187 wants to merge 1 commit into
Open
CaptainAni187 wants to merge 1 commit into
CaptainAni187 wants to merge 1 commit into
Conversation
…er::split split grouped rows in a HashMap, so the pieces came back in hash order. ClusteredWriter needs sorted input to stay sorted: when a partition spans two batches, writing a later piece first closes it and the next batch fails with "Cannot write to partition that was previously closed".
This branch has not been deployed
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?
What changes are included in this PR?
splitgrouped rows in aHashMapand returned the pieces in hash order. Now each partition value remembers its position the first time it shows up, so the pieces come back in first-occurrence order and sorted input stays sorted forClusteredWriter. The order is noted in thesplitdocs since callers can rely on it now.Related: apache/datafusion-iceberg#81 works around this downstream until it picks up a release with this.
Are these changes tested?
Yes,
test_record_batch_partition_split_keeps_first_occurrence_ordersplits 50 partitions given in descending order and checks the keys come back in that order. It fails on main.AI Disclosure
Used Claude Code to help write the fix and the test. I reviewed the change myself and made the design calls independently (fixing it in the splitter rather than downstream, and keeping it dependency-free), and it was checked against the iceberg lib tests, fmt and clippy locally. Worth a look: whether stating the order in the
splitdocs is fine as a guarantee, and the one extraStructclone per partition for the index map.