SourabhBadhya commented on PR #8113:
URL: https://github.com/apache/iceberg/pull/8113#issuecomment-1665441273

   Thanks @Fokko , @rdblue for the reviews.
   
   Currently, Hive supports only `TIMESTAMP WITH LOCAL TIME ZONE`. There is no 
`TIMESTAMP WITH TIME ZONE` type in Hive. Please refer 
[HIVE-16614](https://issues.apache.org/jira/browse/HIVE-16614) especially this 
[comment](https://issues.apache.org/jira/browse/HIVE-16614?focusedCommentId=16140755&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16140755).
 I also checked the current Hive implementation and was able to verify the same.
   
   Answering the questions raised - 
   > How do we handle TIMESTAMP WITH LOCAL TIME ZONE? Do we need a specific 
reader for it?
   
   `IcebergTimestampWithZoneObjectInspectorHive3.java` is the reader for 
`TIMESTAMP WITH LOCAL TIME ZONE` since it extends 
`TimestampLocalTZObjectInspector` interface and there is no `TIMESTAMP WITH 
TIME ZONE` type currently supported by Hive.
   
   > What is the behavior with respect to the session time zone of that type? 
What is responsible for conversion?
   
   `TIMESTAMP WITH LOCAL TIME ZONE` type is supposed to return the timestamp 
data in the timezone of the session. 
   Currently, the time zone of a session is fetched here as follows - 
   ```
     /**
      * A TimestampTZTypeInfo with system default time zone.
      */
     public static final TimestampLocalTZTypeInfo timestampLocalTZTypeInfo = 
new TimestampLocalTZTypeInfo(
         ZoneId.systemDefault().getId());
   ```
   Source - 
https://github.com/apache/hive/blob/master/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java#L72-L73
   
   This `timestampLocalTZTypeInfo` object is used by the constructor of 
`IcebergTimestampWithZoneObjectInspectorHive3.java` -
   ```
     private IcebergTimestampWithZoneObjectInspectorHive3() {
       super(TypeInfoFactory.timestampLocalTZTypeInfo);
     }
   ```
   So essentially the timezone picked is the session timezone.
   
   **This PR make use of session timezone while constructing primitive Java 
objects**.
   
   > What is the session time zone?
   ```
     /**
      * A TimestampTZTypeInfo with system default time zone.
      */
     public static final TimestampLocalTZTypeInfo timestampLocalTZTypeInfo = 
new TimestampLocalTZTypeInfo(
         ZoneId.systemDefault().getId());
   ```
   The session time zone is the system default time zone where the cluster is 
running.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to