hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vineet Garg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-15183) Wrong result with NOT IN involving null values
Date Fri, 11 Nov 2016 03:24:59 GMT

    [ https://issues.apache.org/jira/browse/HIVE-15183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15655987#comment-15655987
] 

Vineet Garg commented on HIVE-15183:
------------------------------------

Queries such as {noformat} select C from R1 where R1.A not in (Select B from R2 where R1.X
= R2.Y) {noformat} is re-written into 

{noformat}
Select C from R1 join
    (
     select count(*) as c1
     from R2
     where B is null
    ) sq1
    on sq1.c1 = 0 left outer join
    ( select B,
      R2.Y as sq2_col0
      from R2) sq2
     on R1.A = sq2.B and R1.X = sq2.sq2_col0
where sq2.B is null
{noformat}




> Wrong result with NOT IN involving null values
> ----------------------------------------------
>
>                 Key: HIVE-15183
>                 URL: https://issues.apache.org/jira/browse/HIVE-15183
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>
>  Reproducer
> {code}
> create table t7(i int, j int);
> create table fixOb(i int, j int);
> insert into t7 values(null, 5);
> insert into t7 values(4, 15);
> insert into fixOb values(-1, 5);
> insert into fixOb values(-1, 15);
> {code}
> Query:
> {code} select * from fixOb where j NOT IN (select i from t7 where t7.j=fixOb.j);  {code}
> Expected Result
> {noformat}
> i  | j  
> ----+----
>  -1 | 15
> {noformat}
> Actual Result
> {noformat} No result {noformat}



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

Mime
View raw message