ArjunPakhan opened a new pull request, #3771: URL: https://github.com/apache/iceberg-python/pull/3771
Fixes #3744 ### Summary When a table undergoes spec-allowed type promotion (`int` → `long` or `float` → `double`), pre-existing manifest files retain their 4-byte bounds (`IntegerType` / `FloatType`). Currently, `_readable_bound` passes these bytes directly to `from_bytes(field.field_type, bound)`. Because `field.field_type` is updated to `LongType()` / `DoubleType()`, `from_bytes` attempts an 8-byte unpack (`_LONG_STRUCT.unpack(b)`), raising `struct.error: unpack requires a buffer of 8 bytes`. ### Changes Made - Updated `_readable_bound` in `pyiceberg/table/inspect.py` to inspect byte lengths before decoding. - If `field_type` is `LongType` / `DoubleType` and `len(bound) == 4`, decode using `IntegerType()` / `FloatType()`. - Added unit tests in `tests/table/test_inspect.py` covering promoted bound deserialization for `LongType` and `DoubleType`. ### Testing - `python -m pytest tests/table/test_inspect.py` (5/5 tests passed). -- 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]
