cloud-fan commented on a change in pull request #26921: [SPARK-30282][SQL] 
Integrate V2 commands with UnresolvedV2Relation into new resolution framework
URL: https://github.com/apache/spark/pull/26921#discussion_r365673895
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -201,22 +201,21 @@ class ResolveSessionCatalog(
     case RenameTableStatement(SessionCatalogAndTable(_, oldName), 
newNameParts, isView) =>
       AlterTableRenameCommand(oldName.asTableIdentifier, 
newNameParts.asTableIdentifier, isView)
 
-    case DescribeTableStatement(
-         nameParts @ SessionCatalogAndTable(catalog, tbl), partitionSpec, 
isExtended) =>
-      loadTable(catalog, tbl.asIdentifier).collect {
-        case v1Table: V1Table =>
-          DescribeTableCommand(tbl.asTableIdentifier, partitionSpec, 
isExtended)
-      }.getOrElse {
-        // The v1 `DescribeTableCommand` can describe view as well.
-        if (isView(tbl)) {
-          DescribeTableCommand(tbl.asTableIdentifier, partitionSpec, 
isExtended)
-        } else {
-          if (partitionSpec.nonEmpty) {
-            throw new AnalysisException("DESCRIBE TABLE does not support 
partition for v2 tables.")
+    case d @ DescribeTable(SessionCatalogAndResolvedTable(resolved), 
partitionSpec, isExtended) =>
+      resolved.table match {
+        case _: V1Table =>
+          DescribeTableCommand(getTableIdentifier(resolved), partitionSpec, 
isExtended)
+        case _ =>
+          // The v1 `DescribeTableCommand` can describe view as well.
+          if (isView(resolved.identifier.asMultipartIdentifier)) {
 
 Review comment:
   I've open https://github.com/apache/spark/pull/27187 to refine it.
   
   This is a feature we missed when designing the new framework, so I opened a 
separated PR to update the framework to support accepting both table and view 
like DESCRIBE command.

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