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 2021/02/12 08:24:57 UTC

[GitHub] [spark] peter-toth commented on a change in pull request #31550: [SPARK-34421][SQL] Resolve temporary functions and views in views with CTEs

peter-toth commented on a change in pull request #31550:
URL: https://github.com/apache/spark/pull/31550#discussion_r575054629



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3943,6 +3943,36 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
       }
     }
   }
+
+  test("SPARK-34421: Resolve temporary functions and views in views with CTEs") {
+    withTempView("temp_view") {
+      spark.udf.register("temp_func", identity[Int](_))
+
+      sql(
+        s"""
+           |CREATE TEMPORARY VIEW temp_view AS
+           |WITH cte AS (
+           |  SELECT temp_func(0)
+           |)
+           |SELECT * FROM cte
+           |""".stripMargin)
+      checkAnswer(sql("SELECT * FROM temp_view"), Row(0))
+    }
+    withTempView("temp_view") {
+      sql("CREATE TEMPORARY VIEW temp_view AS SELECT 0")
+
+      intercept[AnalysisException] {

Review comment:
       Sure, added in https://github.com/apache/spark/pull/31550/commits/1cd1cb34bf82248f42e6b1927c7b65c4c25944c8




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

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