pgaref commented on a change in pull request #1938:
URL: https://github.com/apache/hive/pull/1938#discussion_r573691709



##########
File path: 
common/src/java/org/apache/hadoop/hive/common/type/TimestampTZUtil.java
##########
@@ -127,12 +127,15 @@ public static TimestampTZ parseOrNull(String s, ZoneId 
defaultTimeZone) {
 
   // Converts Date to TimestampTZ.
   public static TimestampTZ convert(Date date, ZoneId defaultTimeZone) {
-    return parse(date.toString(), defaultTimeZone);
+    return new 
TimestampTZ(ZonedDateTime.ofInstant(Instant.ofEpochMilli(date.toEpochMilli()), 
ZoneOffset.UTC)
+        .withZoneSameLocal(defaultTimeZone));
   }
 
   // Converts Timestamp to TimestampTZ.
   public static TimestampTZ convert(Timestamp ts, ZoneId defaultTimeZone) {
-    return parse(ts.toString(), defaultTimeZone);
+    return new TimestampTZ(
+        ZonedDateTime.ofInstant(Instant.ofEpochSecond(ts.toEpochSecond(), 
ts.getNanos()), ZoneOffset.UTC)

Review comment:
       use same style one both?




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

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