dongjoon-hyun commented on a change in pull request #26317: [SPARK-29628][SQL] 
Forcibly create a temporary view in CREATE VIEW if referencing a temporary view
URL: https://github.com/apache/spark/pull/26317#discussion_r340723648
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala
 ##########
 @@ -72,23 +72,16 @@ abstract class SQLViewSuite extends QueryTest with 
SQLTestUtils {
   }
 
   test("create a permanent view on a temp view") {
-    withView("jtv1") {
+    withTempView("jtv1") {
       withTempView("temp_jtv1") {
         withGlobalTempView("global_temp_jtv1") {
           sql("CREATE TEMPORARY VIEW temp_jtv1 AS SELECT * FROM jt WHERE id > 
3")
-          var e = intercept[AnalysisException] {
-            sql("CREATE VIEW jtv1 AS SELECT * FROM temp_jtv1 WHERE id < 6")
-          }.getMessage
-          assert(e.contains("Not allowed to create a permanent view `jtv1` by 
" +
-            "referencing a temporary view `temp_jtv1`"))
+          sql("CREATE VIEW jtv1 AS SELECT * FROM temp_jtv1 WHERE id < 6")
 
           val globalTempDB = spark.sharedState.globalTempViewManager.database
           sql("CREATE GLOBAL TEMP VIEW global_temp_jtv1 AS SELECT * FROM jt 
WHERE id > 0")
-          e = intercept[AnalysisException] {
-            sql(s"CREATE VIEW jtv1 AS SELECT * FROM 
$globalTempDB.global_temp_jtv1 WHERE id < 6")
-          }.getMessage
-          assert(e.contains(s"Not allowed to create a permanent view `jtv1` by 
referencing " +
-            s"a temporary view `global_temp`.`global_temp_jtv1`"))
+          sql(s"CREATE VIEW jtv2 AS SELECT * FROM 
$globalTempDB.global_temp_jtv1 WHERE id < 6")
+
 
 Review comment:
   LEt's remove this extra empty line.

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