amaliujia commented on code in PR #37000:
URL: https://github.com/apache/spark/pull/37000#discussion_r907945624


##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -208,8 +209,18 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
    */
   @throws[AnalysisException]("table does not exist")
   override def listColumns(tableName: String): Dataset[Column] = {
-    val tableIdent = 
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
-    listColumns(tableIdent)
+    // calling `sqlParser.parseTableIdentifier` to parse tableName. If it 
contains only table name
+    // and optionally contains a database name(thus a TableIdentifier), then 
we look up the table in
+    // sessionCatalog. Otherwise we try `sqlParser.parseMultipartIdentifier` 
to have a sequence of
+    // string as the qualified identifier and resolve the table through SQL 
analyzer.
+    try {
+      val tableIdent = 
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
+      listColumns(tableIdent)

Review Comment:
   I think we only need one listColumns? 
   
   If tableIdent is in SessionCatalog, then we convert it 
`spark_catalog.${tableIdent.database}.${tableIdent.name}` then all use 
`listColumns(ident: Seq[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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to