JeroenSchmidt opened a new pull request, #3529: URL: https://github.com/apache/iceberg-python/pull/3529
# Rationale for this change Extends the integer casting logic in `ArrowProjectionVisitor._cast_if_needed` to handle unsigned-to-signed conversions at the same bit width. Specifically uint32 -> int32. This is a follow-up to #2799 (which fixed #2791) where uint8/uint16 casting was addressed. That fix only covered widening conversions (`source_width < target_width`), which missed the uint32 case since both uint32 and int32 are 32-bit. Without this cast, Parquet files are written with the `UINT_32` physical type while Iceberg metadata declares `INT_32`, causing Spark to fail on read. ## Changes / Are these changes tested? `pyiceberg/io/pyarrow.py`: Extended the cast condition to also trigger when the source is an unsigned integer with the same (or smaller) bit width as the signed target `tests/io/test_pyarrow.py`: Added (`pa.uint32()`, `IntegerType()`, `pa.int32()`) test case ## Notes * The cast uses PyArrow's default `safe=True`, so values exceeding `INT32_MAX (2^31-1)` will raise rather than silently corrupt * Existing behavior for all other integer type combinations is unchanged -- 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]
