cloud-fan commented on a change in pull request #25771: [SPARK-28970][SQL]
Implement USE CATALOG/NAMESPACE for Data Source V2
URL: https://github.com/apache/spark/pull/25771#discussion_r323601154
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalog/v2/CatalogManager.scala
##########
@@ -77,40 +77,37 @@ class CatalogManager(conf: SQLConf, defaultSessionCatalog:
TableCatalog) extends
private def getDefaultNamespace(c: CatalogPlugin) = c match {
case c: SupportsNamespaces => c.defaultNamespace()
- case _ => Array.empty[String]
+ case _ => Array("default") // The builtin catalog use "default" as the
default database.
}
private var _currentNamespace: Option[Array[String]] = None
def currentNamespace: Array[String] = synchronized {
- _currentNamespace.getOrElse {
- currentCatalog.map { catalogName =>
- getDefaultNamespace(catalog(catalogName))
- }.getOrElse(Array("default")) // The builtin catalog use "default" as
the default database.
- }
+ _currentNamespace.getOrElse(getDefaultNamespace(currentCatalog))
}
def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {
_currentNamespace = Some(namespace)
}
- private var _currentCatalog: Option[String] = None
+ private var _currentCatalogName: Option[String] = None
Review comment:
nit: we can remove the underscore from the name now.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]