You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/29 07:07:06 UTC
[GitHub] [spark] beliefer commented on a change in pull request #35361: [SPARK-37932][SQL] Fix view bug when using join in duplicate views
beliefer commented on a change in pull request #35361:
URL: https://github.com/apache/spark/pull/35361#discussion_r795010647
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala
##########
@@ -903,4 +903,21 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
}
}
}
+
+ test("SPARK-37932: view join view self with having filter") {
+ withTable("t") {
+ withView("v1") {
+ Seq((2, "test2"), (3, "test3"), (1, "test1")).toDF("id", "name")
+ .write.format("parquet").saveAsTable("t")
+ sql("CREATE VIEW v1 (id, name) AS SELECT id, name FROM t")
+
+ sql("""SELECT l1.id FROM v1 l1
+ | INNER JOIN (
+ | SELECT id FROM v1
+ | GROUP BY id HAVING COUNT(DISTINCT name) > 1
+ | ) l2 ON l1.id = l2.id GROUP BY l1.name, l1.id;
+ """.stripMargin)
Review comment:
> can we also assert query answer correctness ?
+1
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala
##########
@@ -903,4 +903,21 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
}
}
}
+
+ test("SPARK-37932: view join view self with having filter") {
Review comment:
The bug is related to having filter ?
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala
##########
@@ -903,4 +903,21 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
}
}
}
+
+ test("SPARK-37932: view join view self with having filter") {
+ withTable("t") {
+ withView("v1") {
+ Seq((2, "test2"), (3, "test3"), (1, "test1")).toDF("id", "name")
+ .write.format("parquet").saveAsTable("t")
+ sql("CREATE VIEW v1 (id, name) AS SELECT id, name FROM t")
+
+ sql("""SELECT l1.id FROM v1 l1
+ | INNER JOIN (
+ | SELECT id FROM v1
+ | GROUP BY id HAVING COUNT(DISTINCT name) > 1
+ | ) l2 ON l1.id = l2.id GROUP BY l1.name, l1.id;
+ """.stripMargin)
Review comment:
```
"""
|SELECT l1.id FROM v1 l1
|INNER JOIN (
| SELECT id FROM v1
| GROUP BY id HAVING COUNT(DISTINCT name) > 1
|) l2 ON l1.id = l2.id
|GROUP BY l1.name, l1.id
|""".stripMargin
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org