imback82 commented on a change in pull request #26361: [SPARK-29630][SQL] 
Disallow creating a permanent view that references a temporary view in an 
expression
URL: https://github.com/apache/spark/pull/26361#discussion_r342103996
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala
 ##########
 @@ -94,6 +94,30 @@ abstract class SQLViewSuite extends QueryTest with 
SQLTestUtils {
     }
   }
 
+  test("create a permanent view on a temp view used inside an expression") {
+    withTable("base_table") {
+      withTempView("temp_view") {
+        sql("CREATE TABLE base_table (id int) USING parquet")
+        sql("CREATE TEMPORARY VIEW temp_view AS SELECT * FROM base_table")
+
+        val statements = Seq(
+          "CREATE VIEW v AS SELECT * FROM base_table WHERE EXISTS (SELECT * 
FROM temp_view)",
+          "CREATE VIEW v AS SELECT id, (SELECT count(*) FROM temp_view) FROM 
base_table",
+          "CREATE VIEW v AS SELECT * FROM base_table " +
+            "WHERE id IN (SELECT id FROM base_table WHERE EXISTS (SELECT 1 
FROM temp_view))"
 
 Review comment:
   I moved these to `create_view.sql`. The first two scenarios were already 
there, so I just moved the last one. thanks for the feedback.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to