Skip to content

Commit 6435f99

Browse files
committed
Use Instant to generate ZonedDateTime
1 parent 2ba36cc commit 6435f99

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/accessor/impl/calendar/ArrowFlightJdbcTimeStampVectorAccessorTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,8 @@ private ZonedDateTime getZonedDateTime(int currentRow, String timeZone) {
412412
expectedTimestamp = ((LocalDateTime) object).atZone(tz.toZoneId());
413413
} else if (object instanceof Long) {
414414
TimeUnit timeUnit = getTimeUnitForVector(vector);
415-
long millis = timeUnit.toMillis((Long) object);
416-
long offset = tz.getOffset(millis);
417-
// TODO: should we actually add the offset here? I'm not completely sure how the value is
418-
// stored in the vector
419-
LocalDateTime local = new Timestamp(millis + offset).toLocalDateTime();
420-
expectedTimestamp = ZonedDateTime.of(local, tz.toZoneId());
415+
Instant instant = Instant.ofEpochMilli(timeUnit.toMillis((Long) object));
416+
expectedTimestamp = ZonedDateTime.ofInstant(instant, tz.toZoneId());
421417
}
422418
return expectedTimestamp;
423419
}

0 commit comments

Comments
 (0)