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/05/18 09:51:53 UTC

[GitHub] [hive] sankarh commented on a change in pull request #2252: HIVE-25093: date_format() UDF is returning values in UTC time zone only

sankarh commented on a change in pull request #2252:
URL: https://github.com/apache/hive/pull/2252#discussion_r634218204



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/util/DateTimeMath.java
##########
@@ -613,4 +615,18 @@ public static Calendar getProlepticGregorianCalendarUTC() {
     calendar.setGregorianChange(new java.util.Date(Long.MIN_VALUE));
     return calendar;
   }
+
+  /**
+   * TODO - this is a temporary fix for handling Julian calendar dates.
+   * Returns a Gregorian calendar that can be used from year 0+ instead of default 1582.10.15.
+   * This is desirable for some UDFs that work on dates which normally would use Julian calendar.
+   * @return the calendar
+   */
+  public static Calendar getTimeZonedProlepticGregorianCalendar() {
+    GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone(
+        SessionState.get() == null ? new HiveConf().getLocalTimeZone() : SessionState.get().getConf()

Review comment:
       Use () for condition.




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