jbonofre opened a new pull request, #1549:
URL: https://github.com/apache/arrow-java/pull/1549
## What's Changed
Follow-up to #1542.
- `ArrowFlightJdbcTimeStampVectorAccessor` applies a time zone given as an
offset, such as `+03:00`, `-05:30`, `+0300` or `UTC+3`. Before,
`TimeZone.getTimeZone` turned these into GMT, so
`getObject(LocalDateTime/OffsetDateTime)`, `getTimestamp`, `getDate` and
`getTime` were off by the offset, and a `LocalDateTime` bound with `setObject`
did not read back unchanged.
- A name is only parsed with `ZoneId.of(name, ZoneId.SHORT_IDS)`, as the
parameter converter does, when `TimeZone.getTimeZone` does not know it. Names
it knows are parsed as before. For all 632 IDs of `TimeZone.getAvailableIDs()`,
both give the same offsets on JDK 17, 21 and 25, so reading and binding agree
for those too.
- A name neither knows, such as `utc`, is still read as GMT, so reading a
result set doesn't start failing. Binding a parameter with such a name still
fails, as since #1542.
- A timestamp with an empty time zone is handled like one without a time
zone, as the Arrow format specifies ("Timestamps with an unset / empty
timezone") and as `SqlTypes` already reports it (`TIMESTAMP`).
- Reading: `getObject(Instant/OffsetDateTime/ZonedDateTime)` now throws
`SQLException`, as for a column without a time zone. The other getters return
the same values as for a column without a time zone, which in the tests are
also the values they returned before.
- Binding: `setObject(i, LocalDateTime)` binds the wall-clock time as UTC,
as for a parameter without a time zone, instead of failing with
`DateTimeException`. `Instant`, `OffsetDateTime` and `ZonedDateTime` are
rejected, as for a parameter without a time zone.
**This contains breaking changes:** values read from columns with an offset
time zone change (they were wrong), and `Instant`, `OffsetDateTime` and
`ZonedDateTime` can no longer be read from a column with an empty time zone.
## Tests
- `ArrowFlightJdbcTimeStampVectorAccessorTest`: offset time zones through
`getObject(LocalDateTime/Instant/OffsetDateTime)` and `getTimestamp`. An empty
time zone reads like no time zone, with and without a calendar. Unknown names
(`Not/AZone`, `utc`) are still read as GMT.
- `TimestampAvaticaParameterConverterTest`: binding to a parameter with an
empty time zone, and a `LocalDateTime` bound and read back through the accessor
in every unit, for no, empty, named (`UTC`, `America/New_York`, `EST`) and
offset time zones.
The new tests fail on `main` (14 failures), except the unknown-name tests,
which check behaviour that doesn't change. The `flight-sql-jdbc-core` build
passes on JDK 17, including checkstyle, and the two test classes pass on JDK 21
and 25. `spotless:check` passes.
Closes #1548.
--
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]