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

   ### Describe the issue this Pull Request addresses
   
   The Trino connector uses `String.trim()` when converting Avro CHAR values 
into output pages. This removes significant leading whitespace and trailing 
control characters, while failing to enforce the declared CHAR length. 
Consequently, base-only Parquet reads and merge-on-read queries can return 
different values for the same column.
   
   ### Summary and Changelog
   
   Align CHAR conversion in merged reads with Trino’s native CHAR semantics.
   
   - Use Trino’s existing `truncateToLengthAndTrimSpaces` helper with the 
declared `CharType`.
   - Preserve leading whitespace and trailing control characters.
   - Truncate overlength values by Unicode code points and remove trailing 
ASCII-space padding.
   - Add five parameterized cases covering leading spaces, all-space values, 
tabs, supplementary Unicode characters and overlength input. Each case 
exercises both Java `String` and Avro `Utf8`.
   
   Validation: all five `TestHudiAvroCharSerialization` cases passed.
   
   ### Impact
   
   Corrects CHAR values returned by the Trino connector’s merge-on-read path. 
No public API, configuration or storage-format changes. No material performance 
impact is expected.
   
   ### Risk Level
   
   low — The change is limited to CHAR conversion and reuses Trino’s existing 
helper. Focused tests cover whitespace preservation, Unicode-aware truncation 
and both supported string representations.
   
   ### 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