This is an automated email from the ASF dual-hosted git repository.
wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 9dc5e94deb14 [SQL][MINOR][TEST] InMemoryTableCatalog should list
procedures namespaces
9dc5e94deb14 is described below
commit 9dc5e94deb1496a4acf97816b10fd03a922b257b
Author: Szehon Ho <[email protected]>
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 <[email protected]>
Co-authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
---
.../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 45e3dac1c113..3bf3c6582b45 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
@@ -188,7 +188,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: [email protected]
For additional commands, e-mail: [email protected]