Repository navigation
fix: write partitioned tables that have a _partition column - #139
Draft
xanderbailey wants to merge 1 commit into
Draft
xanderbailey wants to merge 1 commit into
xanderbailey wants to merge 1 commit into
Conversation
repartition, sort_by_partition and the partition splitter found the projected partition values by name, so a table column named `_partition` was read in their place and the INSERT failed. Look up the projected column as the last field with that name, and move it to the front before splitting since the splitter takes the first match.
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?
None filed.
Rationale for this change
Inserting into a partitioned table that has its own
_partitioncolumn fails withPartition column is not a StructArray.repartition,sort_by_partitionand the partition splitter all find the projected partition values by name, and the table's column comes first.What changes are included in this PR?
_partition, sinceproject_with_partitionalways appends it after the table columns.TaskWritermoves that column to the front before splitting (the splitter takes the first match), then drops it from the batches it writes.Longer term the splitter in iceberg-rust could take a column index instead.
Are these changes tested?
Yes: an
insert_intotest, plus unit tests forTaskWriter(fanout and clustered),repartitionandsort_by_partition. Theinsert_intotest reads the data files directly, because scanning_partitioncurrently returns the metadata column (apache/iceberg-rust#3362).