imback82 commented on a change in pull request #27187: [SPARK-30497][SQL] migrate DESCRIBE TABLE to the new framework URL: https://github.com/apache/spark/pull/27187#discussion_r366675217
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ########## @@ -900,6 +902,18 @@ class Analyzer( } case _ => u } + + case u @ UnresolvedTableOrView(identifier) => + expandRelationName(identifier) match { + case SessionCatalogAndIdentifier(catalog, ident) => + CatalogV2Util.loadTable(catalog, ident) match { + case Some(v1Table: V1Table) if v1Table.v1Table.tableType == CatalogTableType.VIEW => + ResolvedView(ident) + case Some(table) => ResolvedTable(catalog.asTableCatalog, ident, table) + case None => u + } + case _ => u + } Review comment: nit: This is almost same as `UnresolvedTable` case? Maybe we can do the following, or may not be worthwhile: ```scala case u @ UnresolvedTable(identifier) => lookupTableOrView(u, identifier) { u.failAnalysis(s"$ident is a view not table.") } case u @ UnresolvedTableOrView(identifier) => lookupTableOrView(u, identifier) { ResolvedView(identifier) } } private def lookupTableOrView( unresolved: LogicalPlan, identifier: Seq[String])(viewHandler: => LogicalPlan): LogicalPlan = { expandRelationName(identifier) match { case SessionCatalogAndIdentifier(catalog, ident) => CatalogV2Util.loadTable(catalog, ident) match { case Some(v1Table: V1Table) if v1Table.v1Table.tableType == CatalogTableType.VIEW => viewHandler case Some(table) => ResolvedTable(catalog.asTableCatalog, ident, table) case None => unresolved } case _ => unresolved } ``` ---------------------------------------------------------------- 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