Ilhami,

You probably better off casting the arguments for a couple of benefits:

select * from cdr where calldate in  (cast('2014-08-11' as 
date),cast('2014-05-02' as date))

1. Comparison is done in proper type semantics, and bad argument  to IN will 
raise proper error as opposed to producing incorrect result.

2. Hive *should* do the casting once for the IN arguments per query execution.
    Casting calldate column will be done for every row which in big data will 
have some perf impact. 



Respectfully,
Tuong


________________________________
 From: ilhami Kalkan <ilhami.kal...@intellica.net>
To: user@hive.apache.org 
Sent: Wednesday, August 13, 2014 1:14 AM
Subject: Re: hive query with in statement
 


Thanks Navis it works. 



On 13-08-2014 09:03, Navis류승우 wrote:

Could you try "cast(calldate as string)"? 
>
>
>Thanks,
>Navis
> 
>
>
>
>
>2014-08-12 20:22 GMT+09:00 ilhami Kalkan <ilhami.kal...@intellica.net>:
>
>Hi all,
>>I have a problem with IN statement in HiveQL. My table
                  "cdr", column "calldate" which type is "date". First
                  query is successfully return:
>>select * from cdr where calldate = '2014-05-02';
>>
>>But when query with IN statement,
>>
>>select * from cdr where calldate in (
                  '2014-08-11','2014-05-02');
>>
>>it returns below exception:
>>
>>Error: Error while processing statement: FAILED:
                  SemanticException [Error 10014]: Line 1:38 Wrong
                  arguments ''20014-03-02'': The arguments for IN should
                  be the same type! Types are: {date IN (string,
                  string)} (state=42000,code=10014)
>>
>>How can I handle this?
>>Thanks.
>>
>>Hive version 0.12
>>
>>
>>
>>
>

Reply via email to