jackylee-ch opened a new pull request, #10125:
URL: https://github.com/apache/paimon/pull/10125

   ### Purpose
   
   The `row` file-format reader returned a `TIMESTAMP` value in milliseconds 
for precision ≤ 3 and microseconds for precision > 3. But 
`PyarrowFieldParser.from_paimon_type` maps the precision to four Arrow units — 
`0 → s`, `1-3 → ms`, `4-6 → us`, `7-9 → ns` — and `_build_table` puts the 
integer into that type without conversion. So only precisions 1-6 agreed:
   
   - `TIMESTAMP(0)` (Arrow `s`): a millisecond integer read as seconds — ×1000, 
overflowing (a 2020 instant renders as year 52626).
   - `TIMESTAMP(7-9)` (Arrow `ns`): a microsecond integer read as nanoseconds — 
÷1000 (a 2020 instant renders as 1970).
   
   The reader now returns the value in the unit the precision maps to (seconds 
/ millis / micros / nanos). The wire format (a `millis` long plus, for 
precision > 3, a `nano_of_milli` varint) is unchanged, so this is a read-side 
fix.
   
   ### Tests
   
   `test_timestamp_precisions` round-trips `TIMESTAMP(0/3/6/9)` and asserts 
exact values (fails on master: `TIMESTAMP(0)` overflows, `TIMESTAMP(9)` reads 
1970). `test_timestamp_nanos_decoded_from_wire` pins the nanosecond formula 
against a hand-built wire buffer (`nano_of_milli=123456`), the genuine 
Java-written case.
   


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