Repository navigation
fix: write each batch's partitions in first-row order for the clustered writer - #81
Open
CaptainAni187 wants to merge 1 commit into
Open
CaptainAni187 wants to merge 1 commit into
CaptainAni187 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.
Closes #39
With fanout disabled,
TaskWriterpasses the pieces fromRecordBatchPartitionSplitter::splitstraight toClusteredWriter, but the splitter groups rows in aHashMap, so they come out in arbitrary order. When a partition spans a batch boundary,ClusteredWritercan see it closed and then reopened, and fails with "Cannot write to partition that was previously closed" even though the input is sorted.This went with the
TaskWriterside of the two options in the issue, so no iceberg-rust change is needed. On the clustered path the pieces are now sorted by the first row their partition value appears in the batch. The values come from the batch's_partitioncolumn througharrow_struct_to_literal, the same conversion the splitter uses, so the grouping matches. Fanout and unpartitioned writes are unchanged.This doesn't touch #38: the optimizer can still drop the sort before the writer, so fanout-disabled inserts through SQL need that one too.
Test:
test_task_writer_clustered_partition_spans_batcheswrites 50 sorted partitions of 3 rows in batches of 8, so most batches split a partition. Without the fix it fails every run with the error from the issue.