cloud-fan commented on a change in pull request #27642: [SPARK-30885][SQL] V1 
table name should be fully qualified if catalog name is provided
URL: https://github.com/apache/spark/pull/27642#discussion_r383087768
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSessionCatalogSuite.scala
 ##########
 @@ -39,23 +40,26 @@ class DataSourceV2SQLSessionCatalogSuite
   override protected def verifyTable(tableName: String, expected: DataFrame): 
Unit = {
     checkAnswer(spark.table(tableName), expected)
     checkAnswer(sql(s"SELECT * FROM $tableName"), expected)
-    checkAnswer(sql(s"SELECT * FROM default.$tableName"), expected)
     checkAnswer(sql(s"TABLE $tableName"), expected)
   }
 
   override def getTableMetadata(tableName: String): Table = {
     val v2Catalog = spark.sessionState.catalogManager.currentCatalog
     val nameParts = 
spark.sessionState.sqlParser.parseMultipartIdentifier(tableName)
-    v2Catalog.asInstanceOf[TableCatalog]
-      .loadTable(Identifier.of(Array.empty, nameParts.last))
+    val ident = if (v2Catalog.name == SESSION_CATALOG_NAME) {
+      Identifier.of(nameParts.init.toArray, nameParts.last)
+    } else {
+      Identifier.of(Array.empty, nameParts.last)
 
 Review comment:
   Can't we write `Identifier.of(nameParts.init.toArray, nameParts.last)` for 
the else branch as well?

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