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

   
   ### Purpose
   
   fix #9599
   
   - `ArrowUtils.nonCastedTimestampToEpoch()` computed the epoch second for 
`precision == 0` as `timestamp.getMillisecond() / 1000`. Java integer division 
truncates towards zero, so a pre-epoch value with sub-second millis moves 
forward across the epoch boundary: `-500` (`1969-12-31T23:59:59.500`) becomes 
`0`, i.e. `1970-01-01T00:00:00Z`.
   - Use `Math.floorDiv` so truncation goes towards negative infinity. The 1-3, 
4-6 and 7-9 precision branches are already negative-safe and are untouched.
   - This aligns the write direction with the read direction, fixed the same 
way in #9299 (`Arrow2PaimonVectorConverter.convertEpochToTimestamp`).
   
   ### Tests
   
   - Added `ArrowFormatWriterTest#testWritePreEpochSecondPrecisionTimestamp`: 
an `ArrowFormatWriter` -> `ArrowBatchReader` round trip over `TIMESTAMP(0)` and 
`TIMESTAMP_LTZ(0)`. It fails on master (`expected: "1969-12-31T23:59:59" but 
was: "1970-01-01T00:00"`) and passes with the fix.
   - `mvn -pl paimon-arrow clean install` — 71 tests passed, 0 failures.
   
   
   


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