Repository navigation
Conversation
…an empty time zone as unset Parse a timestamp time zone that TimeZone.getTimeZone does not know, such as "+03:00", with ZoneId, as the parameter converter does, instead of reading the vector as GMT. Names that TimeZone.getTimeZone knows are parsed as before, and unknown names are still read as GMT. Treat an empty time zone like an unset one when reading and binding, as the Arrow format specifies and as SqlTypes already reports it. Closes apache#1548.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed
Follow-up to #1542.
ArrowFlightJdbcTimeStampVectorAccessorapplies a time zone given as an offset, such as+03:00,-05:30,+0300orUTC+3. Before,TimeZone.getTimeZoneturned these into GMT, sogetObject(LocalDateTime/OffsetDateTime),getTimestamp,getDateandgetTimewere off by the offset, and aLocalDateTimebound withsetObjectdid not read back unchanged.ZoneId.of(name, ZoneId.SHORT_IDS), as the parameter converter does, whenTimeZone.getTimeZonedoes not know it. Names it knows are parsed as before. For all 632 IDs ofTimeZone.getAvailableIDs(), both give the same offsets on JDK 17, 21 and 25, so reading and binding agree for those too.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 GH-1540: Bind TIMESTAMP parameters in the vector unit and accept java.time values in Flight SQL JDBC #1542.SqlTypesalready reports it (TIMESTAMP).getObject(Instant/OffsetDateTime/ZonedDateTime)now throwsSQLException, 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.setObject(i, LocalDateTime)binds the wall-clock time as UTC, as for a parameter without a time zone, instead of failing withDateTimeException.Instant,OffsetDateTimeandZonedDateTimeare 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,OffsetDateTimeandZonedDateTimecan no longer be read from a column with an empty time zone.Tests
ArrowFlightJdbcTimeStampVectorAccessorTest: offset time zones throughgetObject(LocalDateTime/Instant/OffsetDateTime)andgetTimestamp. 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 aLocalDateTimebound 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. Theflight-sql-jdbc-corebuild passes on JDK 17, including checkstyle, and the two test classes pass on JDK 21 and 25.spotless:checkpasses.Closes #1548.