[ 
https://issues.apache.org/jira/browse/HIVE-22170?focusedWorklogId=312477&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312477
 ]

ASF GitHub Bot logged work on HIVE-22170:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Sep/19 02:37
            Start Date: 14/Sep/19 02:37
    Worklog Time Spent: 10m 
      Work Description: jcamachor commented on pull request #764: HIVE-22170
URL: https://github.com/apache/hive/pull/764#discussion_r324409305
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToUnixTimeStamp.java
 ##########
 @@ -117,6 +121,19 @@ protected void initializeInput(ObjectInspector[] 
arguments) throws UDFArgumentEx
             + " takes only string/date/timestamp/timestampwltz types. Got 
Type:" + arg1OI
             .getPrimitiveCategory().name());
     }
+
+    if (timeZone == null) {
+      timeZone = SessionState.get().getConf().getLocalTimeZone();
+      formatter.setTimeZone(TimeZone.getTimeZone(timeZone));
+    }
+  }
+
+  public void configure(MapredContext context) {
 
 Review comment:
   No, this is the comment of the super method that it overrides (I added the 
override notation since it was missing):
   ```
     /**
      * Additionally setup GenericUDF with MapredContext before initializing.
      * This is only called in runtime of MapRedTask.
      *
      * @param context context
      */
   ```
   Basically this is needed because we need to set up the timezone from the 
configuration when we are about to execute the udf in each of the nodes, but we 
only have access to the configuration object through this context. This is 
called before calling the initialize method.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 312477)
    Time Spent: 40m  (was: 0.5h)

> from_unixtime and unix_timestamp should use user session time zone
> ------------------------------------------------------------------
>
>                 Key: HIVE-22170
>                 URL: https://issues.apache.org/jira/browse/HIVE-22170
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 3.1.0, 4.0.0, 3.2.0, 3.1.1, 3.1.2
>            Reporter: Riju Trivedi
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-22170.01.patch, HIVE-22170.02.patch, 
> HIVE-22170.03.patch, HIVE-22170.04.patch
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> According to documentation, that is the expected behavior (since session time 
> zone was not present, system time zone was being used previously). This was 
> incorrectly changed by HIVE-12192 / HIVE-20007. This JIRA should fix this 
> issue.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to