wangyum commented on code in PR #42180:
URL: https://github.com/apache/spark/pull/42180#discussion_r1280131962
##########
sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala:
##########
@@ -2712,4 +2712,27 @@ class SubquerySuite extends QueryTest
expected)
}
}
+
+ test("SPARK-44562: Add OptimizeOneRowRelationSubquery in batch of Subquery")
{
+ withTempView("v1", "v2") {
+ sql(
+ """
+ |CREATE temporary VIEW v1
+ |AS
+ |SELECT id, 'foo' AS kind FROM (SELECT 1 AS id) t
+ |""".stripMargin)
+ sql(
+ """
+ |CREATE temporary VIEW v2
+ |AS
+ |SELECT * FROM v1 WHERE kind = (SELECT kind FROM v1 WHERE kind =
'foo')
+ |""".stripMargin)
+ val df = sql("SELECT * FROM v1 JOIN v2 ON v1.id = v2.id")
+ val filter = df.queryExecution.optimizedPlan.collect {
+ case f: Filter => f
+ }
+ assert(filter.isEmpty,
+ "Filter should be removed after OptimizeSubqueries and
OptimizeOneRowRelationSubquery")
+ }
+ }
Review Comment:
ok.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]