This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new c5fe15182f4c [SQL][MINOR][TEST] InMemoryTableCatalog should list 
procedures namespaces
c5fe15182f4c is described below

commit c5fe15182f4c06576556a2bea12ccd7015fe1e9e
Author: Szehon Ho <szehon.apa...@gmail.com>
AuthorDate: Fri Mar 21 15:46:03 2025 +0800

    [SQL][MINOR][TEST] InMemoryTableCatalog should list procedures namespaces
    
    ### What changes were proposed in this pull request?
    Add procedures namespaces to the list of namespaces.
    
    ### Why are the changes needed?
    This makes the list of namespace more accurate
    
    I found this while adding tests for 
https://github.com/apache/spark/pull/50109
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Existing unit test.  I consider to make a test, but it may be overkill as 
its already a test class.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #50329 from szehon-ho/minor-in-memory-catalog.
    
    Lead-authored-by: Szehon Ho <szehon.apa...@gmail.com>
    Co-authored-by: Wenchen Fan <cloud0...@gmail.com>
    Signed-off-by: Wenchen Fan <wenc...@databricks.com>
    (cherry picked from commit 9dc5e94deb1496a4acf97816b10fd03a922b257b)
    Signed-off-by: Wenchen Fan <wenc...@databricks.com>
---
 .../org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala  | 8 +++-----
 .../apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala | 7 ++++++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala
index 437d7ffa6391..14e857e1dae3 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala
@@ -30,11 +30,9 @@ class InMemoryCatalog extends InMemoryTableCatalog with 
FunctionCatalog with Pro
   protected val functions: util.Map[Identifier, UnboundFunction] =
     new ConcurrentHashMap[Identifier, UnboundFunction]()
 
-  override protected def allNamespaces: Seq[Seq[String]] = {
-    (tables.keySet.asScala.map(_.namespace.toSeq) ++
-      functions.keySet.asScala.map(_.namespace.toSeq) ++
-      namespaces.keySet.asScala).toSeq.distinct
-  }
+  override protected def allNamespaces: Seq[Seq[String]] =
+    (super.allNamespaces ++ 
functions.keySet.asScala.map(_.namespace.toSeq)).distinct
+
 
   override def listFunctions(namespace: Array[String]): Array[Identifier] = {
     if (namespace.isEmpty || namespaceExists(namespace)) {
diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala
index ae11cb9d6958..ca645e477eea 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala
@@ -184,7 +184,12 @@ class InMemoryTableCatalog extends 
BasicInMemoryTableCatalog with SupportsNamesp
   procedures.put(Identifier.of(Array("dummy"), "increment"), UnboundIncrement)
 
   protected def allNamespaces: Seq[Seq[String]] = {
-    (tables.keySet.asScala.map(_.namespace.toSeq) ++ 
namespaces.keySet.asScala).toSeq.distinct
+    (tables.keySet.asScala.map(_.namespace.toSeq)
+      ++ namespaces.keySet.asScala
+      ++ procedures.keySet.asScala
+      .filter(i => !i.namespace.sameElements(Array("dummy")))
+      .map(_.namespace.toSeq)
+      ).toSeq.distinct
   }
 
   override def namespaceExists(namespace: Array[String]): Boolean = {


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

Reply via email to