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: [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]

Reply via email to