lidavidm commented on code in PR #37088:
URL: https://github.com/apache/arrow/pull/37088#discussion_r1290072459


##########
java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java:
##########
@@ -188,12 +188,9 @@ public static ArrowType getArrowTypeFromJdbcType(final 
JdbcFieldInfo fieldInfo,
       case Types.TIME:
         return new ArrowType.Time(TimeUnit.MILLISECOND, 32);
       case Types.TIMESTAMP:
-        final String timezone;
-        if (calendar != null) {
-          timezone = calendar.getTimeZone().getID();
-        } else {
-          timezone = null;
-        }
+        return new ArrowType.Timestamp(TimeUnit.MILLISECOND);
+      case Types.TIMESTAMP_WITH_TIMEZONE:
+        final String timezone = calendar == null ? null : 
calendar.getTimeZone().getID();

Review Comment:
   Ok, so Snowflake:
   
   > TIMESTAMP_LTZ internally stores UTC time with a specified precision. 
However, all operations are performed in the current session’s time zone, 
controlled by the 
[TIMEZONE](https://docs.snowflake.com/en/sql-reference/parameters.html#label-timezone)
 session parameter.
   
   > TIMESTAMP_TZ internally stores UTC time together with an associated time 
zone offset. When a time zone is not provided, the session time zone offset is 
used. All operations are performed with the time zone offset specific to each 
record.
   
   Postgres:
   
   > All timezone-aware dates and times are stored internally in UTC.
   
   So the underlying value should be UTC. I think you'll have to look at what 
their JDBC driver specifically does, though: it might localize the value for 
you. I think you may need database-specific converters?



##########
java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java:
##########
@@ -188,12 +188,9 @@ public static ArrowType getArrowTypeFromJdbcType(final 
JdbcFieldInfo fieldInfo,
       case Types.TIME:
         return new ArrowType.Time(TimeUnit.MILLISECOND, 32);
       case Types.TIMESTAMP:
-        final String timezone;
-        if (calendar != null) {
-          timezone = calendar.getTimeZone().getID();
-        } else {
-          timezone = null;
-        }
+        return new ArrowType.Timestamp(TimeUnit.MILLISECOND);
+      case Types.TIMESTAMP_WITH_TIMEZONE:
+        final String timezone = calendar == null ? null : 
calendar.getTimeZone().getID();

Review Comment:
   Ok, so Snowflake:
   
   > TIMESTAMP_LTZ internally stores UTC time with a specified precision. 
However, all operations are performed in the current session’s time zone, 
controlled by the 
[TIMEZONE](https://docs.snowflake.com/en/sql-reference/parameters.html#label-timezone)
 session parameter.
   
   > TIMESTAMP_TZ internally stores UTC time together with an associated time 
zone offset. When a time zone is not provided, the session time zone offset is 
used. All operations are performed with the time zone offset specific to each 
record.
   
   Postgres:
   
   > All timezone-aware dates and times are stored internally in UTC.
   
   So the underlying value should be UTC. I think you'll have to look at what 
their JDBC driver specifically does, though: it might localize the value for 
you. I think you may need database-specific converters?



-- 
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]

Reply via email to