Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-19017

NOT IN subquery with more than one column may return incorrect results

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 2.1.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: SQL
    • Labels:

      Description

      When putting more than one column in the NOT IN, the query may not return correctly if there is a null data. We can demonstrate the problem with the following data set and query:

      Seq((2,1)).toDF("a1","b1").createOrReplaceTempView("t1")
      Seq[(java.lang.Integer,java.lang.Integer)]((1,null)).toDF("a2","b2").createOrReplaceTempView("t2")
      
      sql("select * from t1 where (a1,b1) not in (select a2,b2 from t2)").show
      +---+---+
      | a1| b1|
      +---+---+
      +---+---+
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nsyca Nattavut Sutyanyong
                Reporter:
                nsyca Nattavut Sutyanyong
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: