You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "thswlsqls (via GitHub)" <gi...@apache.org> on 2026/09/04 05:05:10 UTC

[PR] [arrow] Fix second-precision timestamp conversion for pre-epoch values [paimon]

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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [arrow] Fix second-precision timestamp conversion for pre-epoch values [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #9600:
URL: https://github.com/apache/paimon/pull/9600#issuecomment-5572304793

   +1


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [arrow] Fix second-precision timestamp conversion for pre-epoch values [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #9600:
URL: https://github.com/apache/paimon/pull/9600


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org