cloud-fan commented on a change in pull request #30881:
URL: https://github.com/apache/spark/pull/30881#discussion_r549591975



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -235,8 +236,17 @@ class ResolveSessionCatalog(
     case DescribeRelation(ResolvedV1TableOrViewIdentifier(ident), 
partitionSpec, isExtended) =>
       DescribeTableCommand(ident.asTableIdentifier, partitionSpec, isExtended)
 
-    case DescribeColumn(ResolvedV1TableOrViewIdentifier(ident), colNameParts, 
isExtended) =>
-      DescribeColumnCommand(ident.asTableIdentifier, colNameParts, isExtended)
+    case DescribeColumn(ResolvedV1TableOrViewIdentifier(ident), column, 
isExtended) =>
+      column match {
+        case u: UnresolvedAttribute =>
+          // For views, the column will not be resolved by `ResolveReferences` 
because
+          // `ResolvedView` stores only the identifier.
+          DescribeColumnCommand(ident.asTableIdentifier, u.nameParts, 
isExtended)

Review comment:
       It's possible when the column name doesn't exist in the table, and we 
should give a clear error message: `Column $colName does not exist`




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



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

Reply via email to