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 2020/11/18 04:36:01 UTC

[GitHub] [spark] imback82 commented on a change in pull request #30403: [SPARK-33448][SQL] Migrate CACHE/UNCACHE TABLE command to use UnresolvedTableOrView to resolve the identifier

imback82 commented on a change in pull request #30403:
URL: https://github.com/apache/spark/pull/30403#discussion_r525794085



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -570,12 +567,9 @@ class ResolveSessionCatalog(
             "SHOW VIEWS, only SessionCatalog supports this command.")
       }
 
-    case ShowTableProperties(ResolvedV1TableIdentifier(ident), propertyKey) =>
+    case ShowTableProperties(ResolvedV1TableOrViewIdentifier(ident), propertyKey) =>

Review comment:
       A refactoring not related to this PR.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -441,19 +441,16 @@ class ResolveSessionCatalog(
         ShowCreateTableCommand(ident.asTableIdentifier)
       }
 
-    case CacheTableStatement(tbl, plan, isLazy, options) =>
-      val name = if (plan.isDefined) {
-        // CACHE TABLE ... AS SELECT creates a temp view with the input query.
-        // Temp view doesn't belong to any catalog and we shouldn't resolve catalog in the name.
-        tbl
-      } else {
-        parseTempViewOrV1Table(tbl, "CACHE TABLE")
-      }
-      CacheTableCommand(name.asTableIdentifier, plan, isLazy, options)
+    // CACHE TABLE ... AS SELECT creates a temp view with the input query.
+    // Thus, use the identifier in UnresolvedTableOrView directly,
+    case CacheTable(u: UnresolvedTableOrView, plan, isLazy, options) if plan.isDefined =>
+      CacheTableCommand(u.multipartIdentifier.asTableIdentifier, plan, isLazy, options)

Review comment:
       @cloud-fan Please let me know what you think about having `UnresolvedTableOrView` here to eagerly use the identifier if `plan` is defined. Another approach is to have a separate rule to handle `CacheTable(u: UnresolvedTableOrView, ...)`.




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