Peng-Lei opened a new pull request #34030:
URL: https://github.com/apache/spark/pull/34030


   ### What changes were proposed in this pull request?
   Change the CatalogImpl for user-facing catalog API.
   before:
   `private def sessionCatalog: SessionCatalog = 
sparkSession.sessionState.catalog`
   So all the operations we did were based on SessionCatalog any time.
   
   after:
   `private def currentCatalog: CatalogPlugin = 
sparkSession.sessionState.catalogManager.currentCatalog`
   When current catalog is `spark-catalog`, we do the all operations based on 
SessionCatalog.
   Others CatalogPlugin did not support operations  at now. it will throw 
exception temporarily.
   eg: `databaseExists` ,`currentDatabase` and so on.
   
   ### Why are the changes needed?
   [#SPARK-36790](https://issues.apache.org/jira/browse/SPARK-36790)
   User-facting catalog should be access the current catalog.
   eg:
   `
   spark.sql("use testcat")
   -> current catalog != spark.catalog
   spark.sql("use testcat.ns1")
   ->current database != spark.catalog.currentDatabase
   spark.sql("show tables")
   ->result != spark.catalog.listTables
   `
   
   I think the SparkSession.catalog api should be keep exist instead of 
SparkSession.sessionState.catalogManager. So update user-facing catalog to 
adapt CatalogPlugin. At now just throw exception for unsupport the 
CatalogPlugin temporary.
   
   ### Does this PR introduce _any_ user-facing change? 
   No
   
   
   ### How was this patch tested?
   add ut test


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