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 a2e333e4c16 [SPARK-39656][SQL] Fix wrong namespace in
DescribeNamespaceExec
a2e333e4c16 is described below
commit a2e333e4c162d5544c238b9b2d90140fa76e3661
Author: ulysses-you <[email protected]>
AuthorDate: Sat Jul 2 00:14:49 2022 +0800
[SPARK-39656][SQL] Fix wrong namespace in DescribeNamespaceExec
### What changes were proposed in this pull request?
DescribeNamespaceExec change ns.last to ns.quoted
### Why are the changes needed?
DescribeNamespaceExec should show the whole namespace rather than last
### Does this PR introduce _any_ user-facing change?
yes, a small bug fix
### How was this patch tested?
fix test
Closes #37049 from ulysses-you/desc-namespace.
Authored-by: ulysses-you <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
---
.../spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala | 3 ++-
.../apache/spark/sql/execution/command/v2/DescribeNamespaceSuite.scala | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala
index 2e71428bcaa..7f9a62f42dd 100644
---
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala
+++
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala
@@ -23,6 +23,7 @@ import scala.collection.mutable.ArrayBuffer
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.Attribute
import org.apache.spark.sql.connector.catalog.{CatalogV2Util,
SupportsNamespaces}
+import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
/**
* Physical plan node for describing a namespace.
@@ -38,7 +39,7 @@ case class DescribeNamespaceExec(
val metadata = catalog.loadNamespaceMetadata(ns)
rows += toCatalystRow("Catalog Name", catalog.name())
- rows += toCatalystRow("Namespace Name", ns.last)
+ rows += toCatalystRow("Namespace Name", ns.quoted)
CatalogV2Util.NAMESPACE_RESERVED_PROPERTIES.foreach { p =>
rows ++= Option(metadata.get(p)).map(toCatalystRow(p.capitalize, _))
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeNamespaceSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeNamespaceSuite.scala
index f801cdb577e..3f13319fc2d 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeNamespaceSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeNamespaceSuite.scala
@@ -47,7 +47,7 @@ class DescribeNamespaceSuite extends
command.DescribeNamespaceSuiteBase with Com
val description = descriptionDf.collect()
assert(description === Seq(
Row("Catalog Name", catalog),
- Row("Namespace Name", "ns2"),
+ Row("Namespace Name", "ns1.ns2"),
Row(SupportsNamespaces.PROP_COMMENT.capitalize, "test namespace"),
Row(SupportsNamespaces.PROP_LOCATION.capitalize, "file:/tmp/ns_test"),
Row(SupportsNamespaces.PROP_OWNER.capitalize,
Utils.getCurrentUserName()),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]