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 06:58:05 UTC

[GitHub] [spark] chenzhx commented on a change in pull request #35361: [SPARK-37932][SQL] Fix view bug when using join in duplicate views

chenzhx commented on a change in pull request #35361:
URL: https://github.com/apache/spark/pull/35361#discussion_r795010728



##########
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:
       OK. I will assert query answer correctness in ut




-- 
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