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

Illya Yalovyy commented on HIVE-15106:
--------------------------------------

This is a bug in Constant propagation optimizer. It does "unsafe" casting that 
causes data corruption in some cases. 
It was fixed for Hive 2.x by patch HIVE-12749. I don't see a patch for Hive 1.x 
line.

Please keep in mind that there are several very simple workarounds:

1. set hive.optimize.constant.propagation=false;
2. select event_ts from test_order where to_date(event_ts) = 
to_date('2016-11-07'); 

> Hive 1.0 returning only date part of a timestamp
> ------------------------------------------------
>
>                 Key: HIVE-15106
>                 URL: https://issues.apache.org/jira/browse/HIVE-15106
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.0.0
>         Environment: Amazon EMR 4.8
>            Reporter: Hernan Vivani
>
> Hive 1.0 is returning only the date part of a timestamp.
> This is working properly on Hive 0.13 and Hive 2.1.0
> Reproduction steps:
> In Hive 0.13 and Hive 2.1.0:
> hive> create table test_order as select timestamp('2016-11-07 
> 09:29:59.000000') as event_ts;
> hive> select * from test_order;
> 2016-11-07 09:29:59
> hive> select event_ts from test_order where CAST(event_ts AS DATE ) = 
> CAST('2016-11-07' AS DATE );
> 2016-11-07 09:29:59
> But, in Hive 1.0:
> hive> select event_ts from test_order where CAST(event_ts AS DATE ) = 
> CAST('2016-11-07' AS DATE );
> 2016-11-07 00:00:00



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

Reply via email to