You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ckran (JIRA)" <ji...@apache.org> on 2015/04/09 15:19:12 UTC

[jira] [Updated] (HIVE-10266) Boolean expression True and True returns False

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

ckran updated HIVE-10266:
-------------------------
    Description: 
A Hive query with a Boolean expression with day and month calculations that each evaluate to TRUE  with use of AND evaluates to FALSE. 

create table datest (cntr int, date date ) row format delimited fields terminated by ',' stored as textfile ;
insert into table datest values (1,'2015-04-8') ;

select
((DAY('2015-05-25') - DAY(DATE)) < 25), 
((MONTH('2015-05-25') - MONTH(DATE)) = 1) ,
((DAY('2015-05-25') - DAY(DATE)) < 25) AND ((MONTH('2015-05-25') - MONTH(DATE)) = 1) 
from datest 

Returns values
True | True | False 

  was:
A Hive query with a Boolean expression with day and month calculations that each evaluate to TRUE  with use of AND evaluates to FALSE. 

create table datest (cntr int, date date ) row format delimited fields terminated by ',' stored as textfile ;
insert into datest values (1,'2015-04-8') ;

select
((DAY('2015-05-25') - DAY(DATE)) < 25), 
((MONTH('2015-05-25') - MONTH(DATE)) = 1) ,
((DAY('2015-05-25') - DAY(DATE)) < 25) AND ((MONTH('2015-05-25') - MONTH(DATE)) = 1) 
from datest 

Returns values
True | True | False 


> Boolean expression True and True returns False
> ----------------------------------------------
>
>                 Key: HIVE-10266
>                 URL: https://issues.apache.org/jira/browse/HIVE-10266
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.14.0
>            Reporter: ckran
>             Fix For: 0.13.0
>
>
> A Hive query with a Boolean expression with day and month calculations that each evaluate to TRUE  with use of AND evaluates to FALSE. 
> create table datest (cntr int, date date ) row format delimited fields terminated by ',' stored as textfile ;
> insert into table datest values (1,'2015-04-8') ;
> select
> ((DAY('2015-05-25') - DAY(DATE)) < 25), 
> ((MONTH('2015-05-25') - MONTH(DATE)) = 1) ,
> ((DAY('2015-05-25') - DAY(DATE)) < 25) AND ((MONTH('2015-05-25') - MONTH(DATE)) = 1) 
> from datest 
> Returns values
> True | True | False 



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