[ 
https://issues.apache.org/jira/browse/HIVE-19761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sankar Hariappan resolved HIVE-19761.
-------------------------------------
    Resolution: Invalid

> Incorrect evaluation of OR condition 
> -------------------------------------
>
>                 Key: HIVE-19761
>                 URL: https://issues.apache.org/jira/browse/HIVE-19761
>             Project: Hive
>          Issue Type: Bug
>          Components: CLI, Parser
>    Affects Versions: 1.2.1
>            Reporter: Riju Trivedi
>            Priority: Critical
>
> OR clause is evaluated incorrectly in Hive query when the where the condition 
> is evaluated as FALSE or TRUE. If we reverse the condition checks and it is 
> evaluated as TRUE OR FALSE, it works fine.
> Steps to repro :
> {code}
>   CREATE TABLE `rtfnprepro1`(                                                 
>   
>   `id` int,                                                                 
>   `name` string,                                                            
>   `zip` int,                                                                
>   `city` string,                                                            
>   `last` string,                                                            
>   `ssn` int,                                                                
>   `phone` int,                                                              
>   `gender` string,                                                          
>   `weight` int,                                                             
>   `desc` string)                                                            
> PARTITIONED BY (                                                            
>   `country` string)                                                    
> ROW FORMAT SERDE                                                            
>   'org.apache.hadoop.hive.ql.io.orc.OrcSerde'                               
> STORED AS INPUTFORMAT                                                       
>   'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'                         
> OUTPUTFORMAT                                                                 
>   'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
>   
>   
> insert into table rtfnprepro1 partition (country='INDIA') values (1, 
> "abdcghjhkkjkjkkkgj",1,"PIShkjkkjhkkk","abc",1,2,"malhjkkjke",2,"helluuuuo");
> select * from rtfnprepro1 where ((phone=1 and last='adc') OR (phone=2 and 
> last!='adc'));
> select * from rtfnprepro1 where ( (phone=2 and last!='adc') OR (phone=1 and 
> last='adc') );
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to