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

Patrick Surry commented on HIVE-2867:
-------------------------------------

I think I ran into this same problem in Hive 0.10

I have an epoch-seconds value of 1389802875 which corresponds to "2014-01-15 
11:21:15" in my local timezone (America/Montreal).

If I try to convert directly as millis via from_utc_timestamp(1389802875000, 
'America/Los_Angeles') I get the wrong answer "2014-01-15 03:21:15".

My workaround is 
from_utc_timestamp(to_utc_timestamp(from_unixtime(1389802875),'America/Montreal'),
 'America/Los_Angeles') which 
gives the correct "2014-01-15 08:21:15"

> Timestamp is defined to be timezoneless but timestamps appear to be processed 
> in the current timezoneql
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-2867
>                 URL: https://issues.apache.org/jira/browse/HIVE-2867
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 0.8.1
>            Reporter: Michael Ubell
>
> Hive-2272 says:
>    Timestamps are interpreted to be timezoneless and stored as an offset from 
> the UNIX epoch. Convenience UDFs for conversion to and from timezones are 
> provided (to_utc_timestamp, from_utc_timestamp). 
> The following shows that the timezone is used.  The epic should display as 
> 1970-01-01 00:00:00.
> hive> select cast(0 as timestamp) from alltypes limit 1;
> OK
> 1969-12-31 16:00:00
> hive> select to_utc_timestamp(cast(0 as timestamp), 'PST') from alltypes 
> limit 1; 
> OK
> 1970-01-01 00:00:00
> hive> select unix_timestamp(cast("1970-01-01 00:00:00" as timestamp)) from 
> alltypes limit 1;
> OK
> 28800



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to