lidavidm commented on code in PR #464:
URL: https://github.com/apache/arrow-java/pull/464#discussion_r2030534427


##########
flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/accessor/impl/calendar/ArrowFlightJdbcTimeStampVectorAccessor.java:
##########
@@ -68,11 +78,57 @@ public Class<?> getObjectClass() {
     return Timestamp.class;
   }
 
+  @Override
+  public <T> T getObject(final Class<T> type) throws SQLException {
+    final Object value;
+    if (type == OffsetDateTime.class) {
+      value = getOffsetDateTime();
+    } else if (type == LocalDateTime.class) {
+      value = getLocalDateTime(null);
+    } else if (type == ZonedDateTime.class) {
+      value = getZonedDateTime();
+    } else if (type == Instant.class) {
+      value = getInstant();
+    } else if (type == Timestamp.class) {
+      value = getObject();
+    } else {
+      throw new SQLException("invalid class");
+    }
+    return !type.isPrimitive() && wasNull ? null : type.cast(value);
+  }
+
   @Override
   public Object getObject() {
     return this.getTimestamp(null);
   }
 
+  private ZonedDateTime getZonedDateTime() {

Review Comment:
   I think we shouldn't allow getting these objects (Instant, ZonedDateTime, 
OffsetDateTime) unless we know the underlying vector is also zoned. Otherwise 
we're just lying to the user.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to