cshuo opened a new pull request, #19522:
URL: https://github.com/apache/hudi/pull/19522

   ### Describe the issue this Pull Request addresses
   
   Closes #19521.
   
   The Flink `RowData` Parquet writer previously derived the physical width of 
every decimal from precision alone. This produced a schema and encoded values 
that were narrower than the authoritative Hudi/Avro schema when a decimal used 
an over-allocated fixed backing type. The compact-decimal encoding path also 
relied on shifts that are unsafe when the declared fixed width exceeds eight 
bytes.
   
   ### Summary and Changelog
   
   - Honor the declared Avro fixed size when converting fixed-backed decimals 
to Parquet `FIXED_LEN_BYTE_ARRAY`, while retaining the precision-based minimum 
for non-fixed decimal schemas.
   - Use the same resolved width in the `RowData` value writer and sign-extend 
compact positive and negative decimal values when the declared fixed width is 
greater than eight bytes.
   - Add regression coverage for fixed-backed and bytes-backed schemas, 
including compact negative values and encoded byte widths.
   
   ### Impact
   
   Flink Parquet writes now preserve the declared physical width of 
fixed-backed decimal schemas passed to the writer. There are no public API or 
configuration changes. Decimal schemas without a fixed backing type retain the 
existing minimum-width behavior.
   
   ### Risk Level
   
   Low. The change is limited to Flink Parquet decimal schema conversion and 
value encoding. Targeted tests cover schema widths and encoded values for both 
fixed-backed and fallback decimal representations.
   
   ### Documentation Update
   
   None.
   
   ### Contributor's checklist
   
   - [ ] 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