hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Pivovarov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-10488) cast DATE as TIMESTAMP returns incorrect values
Date Thu, 30 Apr 2015 08:05:06 GMT

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

Alexander Pivovarov commented on HIVE-10488:
--------------------------------------------

looks like Orc table contains int values instead of date values
e.g. 1996-01-01=1994

I got very similar results as in the description when I removed quotation marks wrapping date
values:
{code}
--  1996-01-01=1994
hive> select cast(1996-01-01 as timestamp);
OK
1969-12-31 16:00:01.994

--  2000-01-01=1998
hive> select cast(2000-01-01 as timestamp);
OK
1969-12-31 16:00:01.998

--  2000-12-31=1957
hive> select cast(2000-12-31 as timestamp);
OK
1969-12-31 16:00:01.957
{code}
my TimeZone is US/Pacific - this is why time is -8hr from 1970   (1969 4pm)

The description shows 1969 7pm (-5 hours offset from 1970) - So, their timezone is US/Eastern

> cast DATE as TIMESTAMP returns incorrect values
> -----------------------------------------------
>
>                 Key: HIVE-10488
>                 URL: https://issues.apache.org/jira/browse/HIVE-10488
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.13.1
>            Reporter: N Campbell
>            Assignee: Chaoyu Tang
>
> same data in textfile works
> same data loaded into an ORC table does not
> connection property of tez/mr makes no difference.
> select rnum, cdt, cast (cdt as timestamp) from tdt
> 0	<null>	<null>
> 1	1996-01-01	1969-12-31 19:00:09.496
> 2	2000-01-01	1969-12-31 19:00:10.957
> 3	2000-12-31	1969-12-31 19:00:11.322
> vs
> 0	<null>	<null>
> 1	1996-01-01	1996-01-01 00:00:00.0
> 2	2000-01-01	2000-01-01 00:00:00.0
> 3	2000-12-31	2000-12-31 00:00:00.0
> create table  if not exists TDT ( RNUM int , CDT date   )
>  STORED AS orc  ;
> insert overwrite table TDT select * from  text.TDT;
> 0|\N
> 1|1996-01-01
> 2|2000-01-01
> 3|2000-12-31



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

Mime
View raw message