thswlsqls opened a new pull request, #8769:
URL: https://github.com/apache/paimon/pull/8769

   ### Purpose
   
   fix #8766
   
   - `TimestampToTimeCastRule.create()` computed the time-of-day as 
`millisecond % MILLIS_PER_DAY`; for a pre-epoch (negative) millisecond Java's 
`%` yields a negative remainder, producing an invalid TIME internal value 
outside `[0, 86_399_999]`.
   - Replace the modulo with `Math.floorMod`, which returns a non-negative 
result for a positive modulus. Post-epoch results are unchanged.
   - Aligns with the sibling LTZ branch 
(`DateTimeUtils.timestampWithLocalZoneToTime`) and 
`DateTimeUtils.formatTimestampMillis`, which already normalize negative 
time-of-day values.
   
   ### Tests
   
   - Added `CastExecutorTest#testTimestampToTimePreEpoch` asserting independent 
literals: `1969-12-31 23:00:00` -> 82_800_000, `1969-12-31 12:34:56.789` -> 
45_296_789, and a post-epoch case (`1970-01-01 10:00:00` -> 36_000_000) that 
stays unchanged. It fails before the fix (returns -3_600_000).
   - `mvn -pl paimon-common -DfailIfNoTests=false clean install` (JDK 11) 
passed.
   


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