Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19050#discussion_r137167216
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala 
---
    @@ -875,4 +876,70 @@ class SubquerySuite extends QueryTest with 
SharedSQLContext {
           assert(e.message.contains("cannot resolve '`a`' given input columns: 
[t.i, t.j]"))
         }
       }
    +
    +  test("SPARK-21835: Join in correlated subquery should be 
duplicateResolved: case 1") {
    +    withTable("t1") {
    +      withTempPath { path =>
    +        Seq(1 -> "a").toDF("i", "j").write.parquet(path.getCanonicalPath)
    +        sql(s"CREATE TABLE t1 USING parquet LOCATION '${path.toURI}'")
    +
    +        val sqlText =
    +          """
    +            |SELECT * FROM t1
    +            |WHERE
    +            |NOT EXISTS (SELECT * FROM t1)
    +          """.stripMargin
    +        val optimizedPlan = sql(sqlText).queryExecution.optimizedPlan
    +        val join = optimizedPlan.collect {
    +          case j: Join => j
    +        }.head.asInstanceOf[Join]
    --- End diff --
    
    ```Scala
            val join = optimizedPlan.collectFirst { case j: Join => j }.get
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to