a-narsudinov opened a new pull request, #20639:
URL: https://github.com/apache/hudi/pull/20639

   ### Describe the issue this Pull Request addresses
   
   The Trino connector does not handle all Avro decimal representations when 
converting merged records into output pages. Short decimals support 
`GenericData.Fixed`, but long decimals accept only `SqlDecimal`. Neither path 
supports Avro `bytes` values represented as `ByteBuffer`.
   
   Consequently, valid Avro log records can fail with an unhandled-type 
`TrinoException` during merge-on-read queries.
   
   ### Summary and Changelog
   
   Support Avro decimal representations consistently in merged reads.
   
   - Decode `GenericData.Fixed` values for long decimals.
   - Support `ByteBuffer` values for both short and long decimals.
   - Interpret the bytes as a signed, big-endian unscaled integer and apply the 
target decimal scale.
   - Read only the buffer’s remaining region without modifying its position or 
limit.
   - Support heap, positioned, sliced, read-only and direct buffers.
   - Add 20 parameterized cases covering negative values, zero, different 
scales, maximum supported precisions and repeated buffer reads.
   
   Validation: all 29 tests across `TestHudiAvroDecimalSerialization` and the 
existing `TestHudiAvroSerializer` passed.
   
   ### Impact
   
   Allows merge-on-read queries to read valid Avro decimal values that 
previously caused conversion errors. Existing `SqlDecimal` and short 
fixed-decimal handling remain unchanged.
   
   No public API, configuration or storage-format changes.
   
   ### Risk Level
   
   low — The change is limited to decimal conversion. Tests cover both decimal 
widths, supported Avro representations, signed values, precision boundaries and 
buffer variants. Buffer position and limit preservation are explicitly verified.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable


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

Reply via email to