cloud-fan commented on code in PR #37588:
URL: https://github.com/apache/spark/pull/37588#discussion_r1365551061
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala:
##########
@@ -53,4 +82,95 @@ case class ShowTablesExec(
case _ => false
}
}
+
+ private def extendedTable(identifier: Identifier, table: Table): String = {
+ val results = new mutable.LinkedHashMap[String, String]()
+
+ if (!identifier.namespace().isEmpty) {
+ results.put("Namespace", identifier.namespace().quoted)
+ }
+ results.put("Table", identifier.name())
+ val tableType = if
(table.properties().containsKey(TableCatalog.PROP_EXTERNAL)) {
+ CatalogTableType.EXTERNAL
+ } else {
+ CatalogTableType.MANAGED
+ }
+ results.put("Type", tableType.name)
+
+ CatalogV2Util.TABLE_RESERVED_PROPERTIES
+ .filterNot(_ == TableCatalog.PROP_EXTERNAL)
+ .foreach(propKey => {
+ if (table.properties.containsKey(propKey)) {
+ results.put(propKey.capitalize, table.properties.get(propKey))
+ }
+ })
+
+ val properties =
+ conf.redactOptions(table.properties.asScala.toMap).toList
+ .filter(kv => !CatalogV2Util.TABLE_RESERVED_PROPERTIES.contains(kv._1))
+ .sortBy(_._1).map {
+ case (key, value) => key + "=" + value
+ }.mkString("[", ",", "]")
+ if (table.properties().isEmpty) {
+ results.put("Table Properties", properties.mkString("[", ", ", "]"))
+ }
+
+ // Partition Provider & Partition Columns
+ if (table.isPartitionable &&
!table.asPartitionable.partitionSchema().isEmpty) {
+ results.put("Partition Provider", "Catalog")
+ results.put("Partition Columns",
table.asPartitionable.partitionSchema().map(
+ field => quoteIdentifier(field.name)).mkString(", "))
+ }
+
+ if (table.isReadable) {
+ if (table.schema().nonEmpty) results.put("Schema",
table.schema().treeString)
Review Comment:
I think every table has schema, do we really need `if (table.isReadable)`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]