-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Closed
Copy link
Labels
Description
Describe the bug, including details regarding any error messages, version, and platform.
The piece of code below in the class ArrowFlightJdbcTimeStampVectorAccessor does not deal with timezone correctly.
private LocalDateTime getLocalDateTime(Calendar calendar) {
getter.get(getCurrentRow(), holder);
this.wasNull = holder.isSet == 0;
this.wasNullConsumer.setWasNull(this.wasNull);
if (this.wasNull) {
return null;
}
long value = holder.value;
LocalDateTime localDateTime = this.longToLocalDateTime.fromLong(value);
if (calendar != null) {
TimeZone timeZone = calendar.getTimeZone();
long millis = this.timeUnit.toMillis(value);
localDateTime = localDateTime
.minus(timeZone.getOffset(millis) - this.timeZone.getOffset(millis), ChronoUnit.MILLIS);
}
return localDateTime;
}It should call localDateTime.plus instead of localDateTime.minus.
I hit this issue when integrating this into our own JDBC implementation and found that the timestamp string in the ResultSet is wrong when converting between timezones.
Component(s)
Java