smaheshwar-pltr opened a new pull request, #4519:
URL: https://github.com/apache/iceberg-python/pull/4519

   # Rationale for this change
   
   Writes fail with `ValueError: Cannot have redundant partitions` when the 
partition spec has more than one field on the same column. These specs are 
valid, for example:
   
   - `identity(a)` and `bucket[4](a)`, or `bucket` and `truncate` on one column.
   - On v1, after changing a field's transform. A v1 spec can't drop a field, 
so the old one [becomes 
`void`](https://github.com/apache/iceberg/blob/f0e7de3c2f207a49ac3a241ac7346726c08c8f1b/format/spec.md?plain=1#L635)
 and the spec has `void(a)` and `bucket[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`](https://github.com/apache/iceberg/blob/f0e7de3c2f207a49ac3a241ac7346726c08c8f1b/api/src/main/java/org/apache/iceberg/StructTransform.java#L53-L61)),
 Rust 
([`PartitionValueCalculator`](https://github.com/apache/iceberg-rust/blob/3cef7b693e53a3f8c31c9ee1172de298546a8969/crates/iceberg/src/arrow/partition_value_calculator.rs#L72-L90))
 and Go 
([`newPartitionExtractionPlan`](https://github.com/apache/iceberg-go/blob/932fdc21cc9102525c56732fbf3f80c1e54b226b/table/partitioned_fanout_writer.go#L334-L347))
 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to