You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/06/21 06:16:05 UTC

[GitHub] [hive] guptanikhil007 commented on a change in pull request #2409: HIVE-25268: Restore the functionality of date_format UDF

guptanikhil007 commented on a change in pull request #2409:
URL: https://github.com/apache/hive/pull/2409#discussion_r655100775



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateFormat.java
##########
@@ -111,17 +123,18 @@ public Object evaluate(DeferredObject[] arguments) throws HiveException {
     // the function should support both short date and full timestamp format
     // time part of the timestamp should not be skipped
     Timestamp ts = getTimestampValue(arguments, 0, tsConverters);
+
     if (ts == null) {
       Date d = getDateValue(arguments, 0, dtInputTypes, dtConverters);
       if (d == null) {
         return null;
       }
       ts = Timestamp.ofEpochMilli(d.toEpochMilli(id), id);
     }
-
-
-    date.setTime(ts.toEpochMilli(id));
-    String res = formatter.format(date);
+    Timestamp ts2 = TimestampTZUtil.convertTimestampToZone(ts, timeZone, ZoneId.of("UTC"));

Review comment:
       Conversion is required. I have tested without conversion and we get wrong results




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org