schuermannator commented on code in PR #36969:
URL: https://github.com/apache/spark/pull/36969#discussion_r908743436
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -58,15 +52,24 @@ class CatalogImpl(sparkSession: SparkSession) extends
Catalog {
/**
* Returns the current default database in this session.
*/
- override def currentDatabase: String = sessionCatalog.getCurrentDatabase
+ override def currentDatabase: String =
+ sparkSession.sessionState.catalogManager.currentNamespace.mkString(".")
/**
* Sets the current default database in this session.
*/
@throws[AnalysisException]("database does not exist")
override def setCurrentDatabase(dbName: String): Unit = {
- requireDatabaseExists(dbName)
- sessionCatalog.setCurrentDatabase(dbName)
+ val ident =
sparkSession.sessionState.sqlParser.parseMultipartIdentifier(dbName)
+ // ident may or may not include catalog prefix
+ // if it includes the current catalog, strip it. otherwise consider it all
to be namespace
+ val catalog = currentCatalog()
+ val ns = ident.headOption match {
+ // TODO case-sensitivity?
Review Comment:
yea okay I will remove since we have decided not to care about catalog 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]