Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-15040

LATERAL VIEW + WHERE IN ...= WRONG RESULT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 2.0.0
    • None
    • None
    • None

    Description

      This query:

      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) 
      ;
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              fpin Furcy Pin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: