You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "kratos0718 (via GitHub)" <gi...@apache.org> on 2026/07/01 14:33:02 UTC
[PR] Reject DecimalType with precision larger than 38 [iceberg-python]
kratos0718 opened a new pull request, #3593:
URL: https://github.com/apache/iceberg-python/pull/3593
## Summary
The Iceberg [spec](https://iceberg.apache.org/spec/#primitive-types) requires decimal precision to be **38 or less** ("Scale is fixed, precision must be 38 or less"). Currently `DecimalType(39, 0)` — and parsing the type string `"decimal(39, 0)"` — is accepted silently, producing `DecimalType(precision=39, scale=0)`. Precision above 38 isn't representable in decimal's fixed-byte storage, so silently accepting it can corrupt downstream encoding.
The Java reference implementation rejects this: `DecimalType.of(39, 0)` raises `IllegalArgumentException: Decimals with precision larger than 38 are not supported: 39`.
Closes #3583.
## Change
Validate `precision <= 38` in `DecimalType.__init__`, raising `ValueError` with the same message as the Java reference. This covers both direct construction and the string-parse path (`_parse_decimal_type` constructs `DecimalType(precision, scale)`, which routes through `__init__`).
## Test
Added `test_decimal_type_rejects_precision_over_38`: `DecimalType(39, 0)` raises, and the boundary `DecimalType(38, 0)` remains valid.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Reject DecimalType with precision larger than 38 [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko closed pull request #3593: Reject DecimalType with precision larger than 38
URL: https://github.com/apache/iceberg-python/pull/3593
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Reject DecimalType with precision larger than 38 [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on PR #3593:
URL: https://github.com/apache/iceberg-python/pull/3593#issuecomment-5012800975
https://github.com/apache/iceberg-python/pull/3585 has been merged, nevertheless thanks for taking a stap at this @kratos0718
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Reject DecimalType with precision larger than 38 [iceberg-python]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on PR #3593:
URL: https://github.com/apache/iceberg-python/pull/3593#issuecomment-4861704239
There is an existing PR #3584
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org