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

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -191,12 +197,21 @@ case class CreateViewCommand(
       // 2) The temp functions are represented by multiple classes. Most are 
inaccessible from this
       // package (e.g., HiveGenericUDF).
       child.collect {
-        // Disallow creating permanent views based on temporary views.
+        // Permanent views will be created as temporary view if based on 
temporary view.
         case UnresolvedRelation(AsTableIdentifier(ident))
             if sparkSession.sessionState.catalog.isTemporaryTable(ident) =>
-          // temporary views are only stored in the session catalog
-          throw new AnalysisException(s"Not allowed to create a permanent view 
$name by " +
-            s"referencing a temporary view $ident")
+          // Temporary views are only stored in the session catalog
+          if (sparkSession.sqlContext.conf.usePostgreSQLDialect) {
 
 Review comment:
   I have handled pgSQLDialect case here. Since class `CreateViewCommand` of 
sql/core is not accessible from `PostgreSQLDialect` sql/catalyst because 
sql/core is dependent on sql/catalyst.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to