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

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

Thanks [~szehon], I never realised there's an umbrella JIRA for it...
I think the reason is that both {{Timestamp.valueOf}} and 
{{Timestamp.toString}} are done according to local timezone.
In my 1st example, we get a timestamp {{2005-04-03 03:01:00}} when calling 
{{Timestamp.valueOf("2005-04-03 02:01:00")}}.
In the 2nd example, {{2005-04-03 10:01:00}} gets converted to {{2005-04-03 
02:01:00}} as expected. However, when we return the timestamp with {{2005-04-03 
02:01:00}}, again it gets one hour advanced by local timezone.

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