You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "sandyfog (via GitHub)" <gi...@apache.org> on 2023/02/26 03:19:17 UTC

[GitHub] [hudi] sandyfog commented on a diff in pull request #7886: [HUDI-5726] Fix timestamp field is 8 hours longer than the time

sandyfog commented on code in PR #7886:
URL: https://github.com/apache/hudi/pull/7886#discussion_r1118011841


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/AvroToRowDataConverters.java:
##########
@@ -233,7 +234,9 @@ private static AvroToRowDataConverter createTimestampConverter(int precision) {
               "Unexpected object type for TIMESTAMP logical type. Received: " + avroObject);
         }
       }
-      return TimestampData.fromInstant(instant);
+      Timestamp timestamp = new Timestamp(instant.toEpochMilli());
+      timestamp.setNanos(instant.getNano());
+      return TimestampData.fromTimestamp(timestamp);

Review Comment:
   Because RowDataToAvroConverters has used local time zone,so this should  also use local time zone,otherwise read  mor  avro log is  8 hours ahead of the time .



-- 
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: commits-unsubscribe@hudi.apache.org

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