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

Gopal V updated HIVE-16113:
---------------------------
    Description: 
{code}
create table daysales (customer int) partitioned by (dt string);

insert into daysales partition(dt='2001-01-01') values(1);

select * from daysales where nvl(dt='2001-01-01' and customer=1, false);
0 ROWS
{code}

https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java#L384

{code}
2017-03-05T12:37:47,153  WARN [6f053d71-6ad6-4ad0-833d-337f2d499c82 main] 
ppr.PartitionPruner: The expr = NVL(((dt = '2001-01-01') and null),false)
{code}

Because {{true and null => null}}, this turns into {{NVL(null, false)}} 

  was:
{code}
create table daysales (customer int) partitioned by (dt string);

insert into daysales partition(dt='2001-01-01') values(1);

select * from daysales where nvl(dt='2001-01-01' and customer=1, false);
0 ROWS
{code}

https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java#L384

{code}
2017-03-05T12:37:47,153  WARN [6f053d71-6ad6-4ad0-833d-337f2d499c82 main] 
ppr.PartitionPruner: The expr = NVL(((dt = '2001-01-01') and null),false)
{code}

Because {{ true and null => null }}, this turns into {{ NVL(null, false) }}  


> PartitionPruner::removeNonPartCols breaks NULL based udfs like NVL
> ------------------------------------------------------------------
>
>                 Key: HIVE-16113
>                 URL: https://issues.apache.org/jira/browse/HIVE-16113
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>    Affects Versions: 1.2.1, 2.2.0, 2.1.1
>            Reporter: Gopal V
>
> {code}
> create table daysales (customer int) partitioned by (dt string);
> insert into daysales partition(dt='2001-01-01') values(1);
> select * from daysales where nvl(dt='2001-01-01' and customer=1, false);
> 0 ROWS
> {code}
> https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java#L384
> {code}
> 2017-03-05T12:37:47,153  WARN [6f053d71-6ad6-4ad0-833d-337f2d499c82 main] 
> ppr.PartitionPruner: The expr = NVL(((dt = '2001-01-01') and null),false)
> {code}
> Because {{true and null => null}}, this turns into {{NVL(null, false)}} 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to