dmitry-chirkov-dremio opened a new pull request, #1081:
URL: https://github.com/apache/arrow-java/pull/1081
The FlightSQL JDBC driver's `TimestampAvaticaParameterConverter` writes raw
epoch millisecond values (received from Avatica) directly into Arrow timestamp
vectors regardless of the vector's time unit. This causes data corruption when
the server uses SECOND, MICROSECOND, or NANOSECOND precision - the millisecond
value is misinterpreted as the target unit.
## What's Changed
- Modified `TimestampAvaticaParameterConverter` to store the
`ArrowType.Timestamp` from its constructor and use the target time unit to
scale the epoch millisecond value before writing to the vector:
- SECOND: divide by 1,000
- MILLISECOND: pass through
- MICROSECOND: multiply by 1,000
- NANOSECOND: multiply by 1,000,000
- Added unit tests covering all 8 timestamp vector types (4 units ×
with/without timezone)
**This contains breaking changes.**
Yes. `PreparedStatement#setTimestamp()` now correctly converts timestamp
values for non-millisecond precision columns. Previously, timestamps inserted
via the FlightSQL JDBC driver into SECOND, MICROSECOND, or NANOSECOND columns
were silently corrupted.
**This PR contains a "Critical Fix".** The bug caused incorrect data to be
stored on the server when using `PreparedStatement#setTimestamp()` with any
timestamp precision other than milliseconds.
Closes #838
--
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]