yuchenhuo commented on a change in pull request #26957: [SPARK-30314] Add 
identifier and catalog information to DataSourceV2Relation
URL: https://github.com/apache/spark/pull/26957#discussion_r366607152
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
 ##########
 @@ -44,15 +44,35 @@ class CatalogManager(
   import CatalogManager.SESSION_CATALOG_NAME
 
   private val catalogs = mutable.HashMap.empty[String, CatalogPlugin]
+  // Map from catalog back to it's original name for easy name look up, we 
don't use the
+  // CatalogPlugin's name as it might be different from the catalog name 
depending on
+  // implementation. Catalog name <-> CatalogPlugin instance is a 1:1 mapping.
+  private val catalogIdentifiers = mutable.HashMap.empty[CatalogPlugin, String]
+  catalogIdentifiers(defaultSessionCatalog) = SESSION_CATALOG_NAME
 
 Review comment:
   No, the concern here is that if a user set a custom session catalog 
implementation and spark fail to load it, it would fall back to use 
`defaultSessionCatalog`. 
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala#L88.
  So we need to set the defaultSessionCatalog in the reverse map here

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