cloud-fan commented on code in PR #47592:
URL: https://github.com/apache/spark/pull/47592#discussion_r1704810269


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala:
##########
@@ -107,16 +107,19 @@ class CatalogManager(
   }
 
   def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {

Review Comment:
   how about
   ```
   private def assertNamespaceExist(namespace: Array[String]): Unit = {
     currentCatalog match {
       case catalog: SupportsNamespaces if !catalog.namespaceExists(namespace) 
=>
         ...
       case _ =>
     }
   }
   
   def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {
     if (isSessionCatalog(currentCatalog) && namespace.length == 1) {
       v1SessionCatalog.validateGlobalTempView(namespace.head)
       assertNamespaceExist(namespace)
       v1SessionCatalog.setCurrentDatabaseWithoutCheck(namespace.head)
     } else {
       assertNamespaceExist(namespace)
     }
      _currentNamespace = Some(namespace)
   }
   ```



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to