Skip to content

Commit 2182992

Browse files
committed
don't show reserved properties if none
1 parent c76e5b5 commit 2182992

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeNamespaceExec.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,18 @@ case class DescribeNamespaceExec(
4343
val metadata = catalog.loadNamespaceMetadata(ns)
4444

4545
rows += toCatalystRow("Namespace Name", ns.last)
46-
rows += toCatalystRow("Description", metadata.get(PROP_COMMENT))
47-
rows += toCatalystRow("Location", metadata.get(PROP_LOCATION))
48-
rows += toCatalystRow("Owner Name", metadata.getOrDefault(PROP_OWNER_NAME, ""))
49-
rows += toCatalystRow("Owner Type", metadata.getOrDefault(PROP_OWNER_TYPE, ""))
46+
Option(metadata.get(PROP_COMMENT)).foreach {
47+
rows += toCatalystRow("Description", _)
48+
}
49+
Option(metadata.get(PROP_LOCATION)).foreach {
50+
rows += toCatalystRow("Location", _)
51+
}
52+
Option(metadata.get(PROP_OWNER_NAME)).foreach {
53+
rows += toCatalystRow("Owner Name", _)
54+
}
55+
Option(metadata.get(PROP_OWNER_TYPE)).foreach {
56+
rows += toCatalystRow("Owner Type", _)
57+
}
5058

5159
if (isExtended) {
5260
val properties = metadata.asScala -- RESERVED_PROPERTIES.asScala

0 commit comments

Comments
 (0)