viirya commented on a change in pull request #27550: [SPARK-30799][SQL] 
CatalogAndIdentifier shouldn't return wrong namespace
URL: https://github.com/apache/spark/pull/27550#discussion_r378485273
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
 ##########
 @@ -103,16 +103,7 @@ private[sql] trait LookupCatalog extends Logging {
     def unapply(nameParts: Seq[String]): Option[(CatalogPlugin, Identifier)] = 
{
       assert(nameParts.nonEmpty)
       if (nameParts.length == 1) {
-        // If the current catalog is session catalog, the current namespace is 
not used because
-        // the single-part name could be referencing a temp view, which 
doesn't belong to any
-        // namespaces. An empty namespace will be resolved inside the session 
catalog
-        // implementation when a relation is looked up.
-        val ns = if (CatalogV2Util.isSessionCatalog(currentCatalog)) {
-          Array.empty[String]
-        } else {
-          catalogManager.currentNamespace
-        }
-        Some((currentCatalog, Identifier.of(ns, nameParts.head)))
+        Some((currentCatalog, Identifier.of(catalogManager.currentNamespace, 
nameParts.head)))
 
 Review comment:
   Hmm, this adds current namespace to the returned identifier? So we cannot 
tell if a returned identifier is for a temp view?

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

Reply via email to