xiaoxuandev opened a new pull request, #17002:
URL: https://github.com/apache/iceberg/pull/17002

   `VariantShreddingAnalyzer` shredded a decimal with precision > 18 into a 
`FIXED_LEN_BYTE_ARRAY` typed_value with a hardcoded length of 16. The writer 
(`FixedDecimalWriter`) instead emits the minimum number of bytes for the 
precision, `TypeUtil.decimalRequiredBytes` (e.g. 9 bytes for precision 20), so 
the write fails with `IllegalArgumentException: 'Fixed Binary size 9 does not 
match field type length 16'`. This breaks write/read of any variant holding an 
int128-range value (stored as DECIMAL16), such as an integer with 19-34 digits.
   
   The hardcoded 16 was the only fixed-decimal width in the codebase not 
derived from `decimalRequiredBytes`; TypeToMessageType and every Parquet 
decimal writer already use it. The constant only matched the writer at 
precision 35-38 (where decimalRequiredBytes == 16); for 19-34 the declared 
length exceeded the bytes the writer emits. Set the length to 
TypeUtil.decimalRequiredBytes(maxPrecision) to realign this outlier. Precision 
<= 18 is unaffected (INT32/INT64).


-- 
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