Riju Trivedi created HIVE-19761:
-----------------------------------

             Summary: 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
            Reporter: Riju Trivedi


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