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


##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -493,14 +493,10 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
    */
   override def tableExists(tableName: String): Boolean = {
     try {
-      val tableIdent = 
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
-      tableExists(tableIdent.database.orNull, tableIdent.table)
+      getTable(tableName)
+      true
     } catch {
-      case e: org.apache.spark.sql.catalyst.parser.ParseException =>
-        val ident = 
sparkSession.sessionState.sqlParser.parseMultipartIdentifier(tableName)
-        val catalog =
-          
sparkSession.sessionState.catalogManager.catalog(ident(0)).asTableCatalog
-        catalog.tableExists(Identifier.of(Array(ident(1)), ident(2)))

Review Comment:
   This is wrong assumption that `ident(1)` is namespace and `ident(2)` is 
table name.



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