[ 
https://issues.apache.org/jira/browse/HIVE-14305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15388951#comment-15388951
 ] 

Rui Li commented on HIVE-14305:
-------------------------------

[~rdblue] - Suppose I run {{select to_utc_timestamp('2005-04-03 
02:01:00','UTC');}} on a machine in PDT. It should return {{2005-04-03 
02:01:00}} because the original timezone and target timezone are both UTC. 
# In the UDF {{GenericUDFFromUtcTimestamp::evaluate}}, we change the default 
timezone from PDT to UTC as you suggested.
# Then we performed the computation in UTC and get the expected Timestamp of 
"2005-04-03 02:01:00".
# Then we change the default timezone back to PDT and return the timestamp.
# When the result gets printed to user, it'll be converted to string 
{{2005-04-03 03:01:00}} because of DST. And this not the expected result.

Please let me know if I misunderstand your point.

> To/From UTC timestamp may return incorrect result because of DST
> ----------------------------------------------------------------
>
>                 Key: HIVE-14305
>                 URL: https://issues.apache.org/jira/browse/HIVE-14305
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Rui Li
>            Assignee: Rui Li
>
> If the machine's local timezone involves DST, the UDFs return incorrect 
> results.
> For example:
> {code}
> select to_utc_timestamp('2005-04-03 02:01:00','UTC');
> {code}
> returns {{2005-04-03 03:01:00}}. Correct result should be {{2005-04-03 
> 02:01:00}}.
> {code}
> select to_utc_timestamp('2005-04-03 10:01:00','Asia/Shanghai');
> {code}
> returns {{2005-04-03 03:01:00}}. Correct result should be {{2005-04-03 
> 02:01:00}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to