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 2019/10/30 11:23:59 UTC

[GitHub] [spark] amanomer commented on a change in pull request #26317: [SPARK-29628] Forcibly create a temporary view in CREATE VIEW if referencing a temporary view

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

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -110,38 +110,44 @@ case class CreateViewCommand(
 
   private def isTemporary = viewType == LocalTempView || viewType == GlobalTempView
 
-  // Disallows 'CREATE TEMPORARY VIEW IF NOT EXISTS' to be consistent with 'CREATE TEMPORARY TABLE'
-  if (allowExisting && isTemporary) {
-    throw new AnalysisException(
-      "It is not allowed to define a TEMPORARY view with IF NOT EXISTS.")
-  }
+  if(isTemporary) verifyTempView()
+
+  private def verifyTempView(): Unit = {
+    // Disallows 'CREATE TEMPORARY VIEW IF NOT EXISTS'
+    // to be consistent with 'CREATE TEMPORARY TABLE'
+    if (allowExisting) {
+      throw new AnalysisException(
+        "It is not allowed to define a TEMPORARY view with IF NOT EXISTS.")
+    }
 
-  // Temporary view names should NOT contain database prefix like "database.table"
-  if (isTemporary && name.database.isDefined) {
-    val database = name.database.get
-    throw new AnalysisException(
-      s"It is not allowed to add database prefix `$database` for the TEMPORARY view name.")
+    // Temporary view names should NOT contain database prefix like "database.table"
+    if (name.database.isDefined) {
 
 Review comment:
   `name.database` returns String.

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


With regards,
Apache Git Services

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