[
https://issues.apache.org/jira/browse/HIVE-19484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469911#comment-16469911
]
Vineet Garg commented on HIVE-19484:
------------------------------------
[[email protected]] Which version of hive are you seeing this issue on?
I tried it on master and I am getting expected result in both cases.
> 'IN' & '=' do not behave the same way for Date/Timestamp comparison.
> --------------------------------------------------------------------
>
> Key: HIVE-19484
> URL: https://issues.apache.org/jira/browse/HIVE-19484
> Project: Hive
> Issue Type: Bug
> Reporter: Venu Yanamandra
> Priority: Major
>
> We find that there is a difference in the way '=' operator and 'IN' behave
> when operating on timestamps.
> The issue could be demonstrated using below -
> i) create table test_table (test_date timestamp);
> ii) insert into test_table values('2018-01-01');
> iii) select * from test_table where test_date='2018-01-01'; -- Works
> iv) select * from test_table where test_date in ('2018-01-01'); -- Fails
> with error [1]
> v) However, casting works -
> select * from test_table where test_date in (cast ('2018-01-01' as
> timestamp));
> As per url [2], we find no references to limitations when '=' or 'IN' are
> used.
> As per the url [3], we find that there are implicit type conversions defined.
> However, '=' operates in a different way than the 'IN' operator.
> We would like to see if 'IN' could be made to behave the same way as '='.
> [1]:
> Caused by: org.apache.hadoop.hive.ql.exec.UDFArgumentException: The
> arguments for IN should be the same type! Types are: {timestamp IN (string)}
> [2]:
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-LogicalOperators
> [3]:
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-AllowedImplicitConversions
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)