Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-18455 General support for correlated subquery processing
  3. SPARK-18966

NOT IN subquery with correlated expressions may return incorrect result

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.2.0
    • SQL

    Description

      Seq((1, 2)).toDF("a1", "b1").createOrReplaceTempView("t1")
      Seq[(java.lang.Integer, java.lang.Integer)]((1, null)).toDF("a2", "b2").createOrReplaceTempView("t2")
      
      // The expected result is 1 row of (1,2) as shown in the next statement.
      sql("select * from t1 where a1 not in (select a2 from t2 where b2 = b1)").show
      +---+---+
      | a1| b1|
      +---+---+
      +---+---+
      
      sql("select * from t1 where a1 not in (select a2 from t2 where b2 = 2)").show
      +---+---+
      | a1| b1|
      +---+---+
      |  1|  2|
      +---+---+
      

      The two SQL statements above should return the same result.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: