ggangadharan commented on code in PR #5590:
URL: https://github.com/apache/hive/pull/5590#discussion_r1909967872


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergTimestampObjectInspectorHive3.java:
##########
@@ -55,7 +56,13 @@ public Timestamp getPrimitiveJavaObject(Object o) {
     if (o == null) {
       return null;
     }
-    LocalDateTime time = (LocalDateTime) o;
+    LocalDateTime time;
+    if (o instanceof OffsetDateTime) {
+      OffsetDateTime odt = (OffsetDateTime) o;
+      time = 
odt.atZoneSameInstant(TypeInfoFactory.timestampLocalTZTypeInfo.getTimeZone()).toLocalDateTime();
+    } else {
+      time = (LocalDateTime) o;

Review Comment:
   Thanks for the detailed update @okumin 
   
   if it's okay. I will make the below code changes.
   ```
    public Timestamp getPrimitiveJavaObject(Object o) {
       if (o == null) {
         return null;
       }
       LocalDateTime time;
       if (o instanceof LocalDateTime) {
         time = (LocalDateTime) o;
       } else if (o instanceof OffsetDateTime) {
         OffsetDateTime odt = (OffsetDateTime) o;
         time = 
odt.atZoneSameInstant(TypeInfoFactory.timestampLocalTZTypeInfo.getTimeZone()).toLocalDateTime();
       } else {
         throw new ClassCastException(String.format("An unexpected type %s was 
passed as timestamp. " +
                 "Expected LocalDateTime/OffsetDateTime", 
o.getClass().getName()));
       }
       return 
Timestamp.ofEpochMilli(time.toInstant(ZoneOffset.UTC).toEpochMilli(), 
time.getNano());
     }
   ```
   
   Please check and let me know. 
   



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