xxlaykxx opened a new pull request, #1541:
URL: https://github.com/apache/arrow-java/pull/1541

   ## What's Changed
   
   `TIME` columns read through the Flight SQL JDBC driver were truncated to 
milliseconds and shifted by the client JVM timezone, and `TIME` parameters 
could not be bound correctly. With the client in `Europe/Berlin`, 
`12:34:56.123456` from a `Time(MICROSECOND, 64)` column was returned as 
`13:34:56.123`.
   
   All changes are in `flight/flight-sql-jdbc-core`.
   
   **Reading (`ArrowFlightJdbcTimeVectorAccessor`, `ArrowFlightJdbcTime`)**
   
   * Every read path now starts from a `LocalTime` built from the raw vector 
value in nanoseconds.
   * `getObject(i, LocalTime.class)` returns the full fraction and returns 
`null` on a NULL row instead of throwing `NullPointerException`.
   * `getTime`, `getObject` and `getString` return the wall-clock time in any 
JVM default timezone. `getTime(calendar)` returns the wall-clock time in the 
timezone of the calendar.
   * `ArrowFlightJdbcTime` carries the nanosecond fraction: `toString` prints 
3, 6 or 9 fractional digits and `toLocalTime()` returns the full fraction. 
`java.sql.Time` itself is limited to milliseconds, so `getString` and 
`getObject(i, LocalTime.class)` are the lossless paths.
   * `getTimestamp` keeps the nanoseconds as well.
   
   **Binding (`TimeAvaticaParameterConverter`)**
   
   * `PreparedStatement.setObject(i, LocalTime)` is accepted. It failed before 
with `Binding value of type OBJECT is not yet supported for expected Arrow type 
Time(MICROSECOND, 64)`.
   * The value is converted to the unit of the parameter vector. Before, the 
millisecond value was written unchanged into second, microsecond and nanosecond 
vectors.
   
   ### Behaviour changes to review
   
   * `getTime` with no calendar now returns wall-clock time, so a client that 
compensates for the old timezone shift will see a different value. I did not 
add a legacy path like `getTimestampWithOffset` in the timestamp accessor; 
guidance on whether one is wanted is welcome (see the question in #1539).
   * The number of fractional digits follows the value, not the column unit: 
`12:34:56` in a microsecond column still prints as `12:34:56`. This keeps the 
output for whole-second and millisecond values as it was.
   * A stored value outside 0-24h is wrapped into the day instead of being 
rejected.
   * `ArrowFlightJdbcTime.hashCode` depends only on the millisecond value, to 
stay consistent with `equals`.
   
   ### Testing
   
   * New tests for microsecond and nanosecond values under `UTC`, 
`Europe/Berlin`, `America/Vancouver` and `Asia/Kolkata` default timezones, NULL 
rows, and binding `LocalTime` and `java.sql.Time` to all four time units.
   * `mvn -pl flight/flight-sql-jdbc-core -am verify` for the driver tests: 
1363 tests, 0 failures, 6 errors. The 6 errors are TLS connection tests that 
need `testing/data/flight/cert0.pem`; the `testing` submodule was not checked 
out locally. The style and static checks pass.
   * Not tested end to end against a real Flight SQL server.
   
   The same unit problem exists for `TIMESTAMP` parameters; it is tracked 
separately in #1540 and not changed here.
   
   AI assistance disclosure: this change and description were prepared with the 
help of an AI coding assistant; the checks above were run locally.
   
   Closes #1539.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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