Repository navigation
Fix writes to partition specs with several fields on one source column - #4519
Merged
kevinjqliu merged 2 commits intoNov 30, 2026
Merged
kevinjqliu merged 2 commits into
kevinjqliu merged 2 commits into
Conversation
PartitionKey looked up each value's partition field by its source column and raised "Cannot have redundant partitions" when the spec had more than one field on that column, such as void(a) and bucket[4](a) after changing a transform on v1, or identity(a) and bucket[4](a) on v2. Each value already names its partition field, so use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
smaheshwar-pltr
commented
Nov 29, 2026
Comment on lines
-473
to
-475
| partition_fields = self.partition_spec.source_id_to_fields_map[raw_partition_field_value.field.source_id] | ||
| if len(partition_fields) != 1: | ||
| raise ValueError(f"Cannot have redundant partitions: {partition_fields}") |
Contributor
Author
There was a problem hiding this comment.
See the PR description for why I think it's fine to remove this check to mirror the other implementations (I've checked Java, Rust, and Go here)
smaheshwar-pltr
marked this pull request as ready for review
November 29, 2026 23:20
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Rationale for this change
Writes fail with
ValueError: Cannot have redundant partitionswhen the partition spec has more than one field on the same column. These specs are valid, for example:identity(a)andbucket[4](a), orbucketandtruncateon one column.voidand the spec hasvoid(a)andbucket[4](a).The writer pairs each partition field with its value, but then looked the field up again by its source column and raised if the column had more than one. This uses the field it already has. The lookup was only used to get the source column's type, which every field on that column shares, so other specs get the same partition values as before. Java (
StructTransform), Rust (PartitionValueCalculator) and Go (newPartitionExtractionPlan) also compute each field's value separately.Are these changes tested?
Yes. A catalog test writes to bucket + truncate and identity + bucket specs on v2 and a void + bucket spec on v1, and checks the partition values, filter pruning and rows read back. It fails without the fix.
Are there any user-facing changes?
Appends, overwrites, upserts, and deletes that rewrite files now work for these specs.
AI Disclosure: This PR was authored by Claude Code (Opus 5.5) but directed and overseen by me.