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

   ### Describe the issue this Pull Request addresses
   
   The Trino connector reinterprets `SqlTimestamp` values from Parquet using 
`ZoneId.systemDefault()` when building merged output pages. These values 
already contain Trino’s timestamp-without-time-zone representation, so applying 
the JVM time zone introduces an incorrect shift.
   
   For example, `1970-01-01 00:00:01` becomes `1969-12-31 23:00:01` in 
`Europe/Belgrade`. Avro log records carry epoch microseconds directly and do 
not receive the same shift, making results depend on the record’s source and 
the JVM time zone.
   
   The conversion can also fail for pre-epoch values because it constructs a 
negative nanosecond component.
   
   ### Summary and Changelog
   
   Preserve timestamp values when converting merged records into Trino output 
pages.
   
   - Copy `SqlTimestamp.getEpochMicros()` and `getPicosOfMicros()` directly 
into the output block.
   - Remove the redundant time-zone conversion, calendar reconstruction and 
associated overflow checks.
   - Preserve the existing handling of epoch-microsecond values from Avro logs.
   - Add tests around the Unix epoch and Page-to-record-to-Page round trips in 
UTC, Europe/Belgrade, America/Los_Angeles and Asia/Kathmandu.
   - Cover fractional precision, winter and summer dates, DST gaps and overlaps.
   - Isolate tests that change the JVM default time zone and restore it 
afterward.
   
   Validation: all 10 `TestHudiAvroTimestampSerialization` cases passed.
   
   ### Impact
   
   Corrects timestamp-without-time-zone values returned by merge-on-read 
queries and removes their dependence on the JVM default time zone.
   
   No public API, configuration or storage-format changes.
   
   ### Risk Level
   
   low — The change replaces calendar conversion with direct copying of Trino’s 
existing timestamp fields. Tests verify value and fractional-precision 
preservation across four time zones, DST boundaries and pre-epoch dates.
   
   ### 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