Skip to content

Commit

Permalink
[SPARK-39656][SQL][3.3] Fix wrong namespace in DescribeNamespaceExec
Browse files Browse the repository at this point in the history
backport #37049 for branch-3.3

### 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 #37071 from ulysses-you/desc-namespace-3.3.

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: huaxingao <huaxin_gao@apple.com>
  • Loading branch information
ulysses-you authored and huaxingao committed Jul 5, 2022
1 parent 2edd344 commit f9e3668
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -37,7 +38,7 @@ case class DescribeNamespaceExec(
val ns = namespace.toArray
val metadata = catalog.loadNamespaceMetadata(ns)

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, _))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DescribeNamespaceSuite extends command.DescribeNamespaceSuiteBase with Com
))
val description = descriptionDf.collect()
assert(description === Seq(
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()))
Expand Down

0 comments on commit f9e3668

Please sign in to comment.