gitcommit90 opened a new pull request, #3584: URL: https://github.com/apache/iceberg-python/pull/3584
The [Iceberg spec](https://iceberg.apache.org/spec/#primitive-types) states precision must be 38 or less (minimum 1). The Python library silently accepted any precision value; `DecimalType(39, 0)` succeeded with no error, which can corrupt downstream fixed-byte decimal encoding. The Java reference implementation rejects it: `DecimalType.of(39, 0)` raises `IllegalArgumentException`. **Fix:** Add a 2-line guard in `DecimalType.__init__` that raises `pyiceberg.exceptions.ValidationError` when `precision < 1` or `precision > 38`. Uses the same exception class and pattern already used throughout `pyiceberg/types.py`. **Tests added (4 new):** - `test_decimal_precision_above_38_raises` — precision=39 raises - `test_decimal_precision_zero_raises` — precision=0 raises - `test_decimal_precision_boundary_38_accepted` — precision=38 accepted - `test_decimal_deserialization_precision_above_38_raises` — deserialization path also raises All 292 existing tests pass; ruff clean. closes #3583 -- 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]
