Furcy Pin created HIVE-15040:
--------------------------------

             Summary: LATERAL VIEW + WHERE IN ...= WRONG RESULT
                 Key: HIVE-15040
                 URL: https://issues.apache.org/jira/browse/HIVE-15040
             Project: Hive
          Issue Type: Bug
    Affects Versions: 2.0.0
            Reporter: Furcy Pin
            Priority: Critical


This query:

{code}
SELECT 
  COUNT(1)
FROM (
  SELECT 1 as c1 , Array(1, 2, 3) as c2 
  UNION ALL 
  SELECT 2 as c1 , Array(2, 3, 4) as c2 
) T
LATERAL VIEW explode(c2) LV AS c
WHERE c = 42
AND T.c1 NOT IN (SELECT 1 UNION ALL SELECT 3) 
;
{code}

returns {{3}} in Hive 1.1.0 and 2.0.0

But obviously it should return 0, since {{c = 42}} is false.
It seems that the clause is ignored.

Spark-SQL does return {{0}}.

P.S. The UNION ALL is not causing the bug, I just wanted to demonstrate is with 
a standalone query. Using regular tables instead still causes the same bug.




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

Reply via email to