dongjoon-hyun commented on a change in pull request #23883: [SPARK-26982][SQL]
Enhance describe framework to describe the output of a query.
URL: https://github.com/apache/spark/pull/23883#discussion_r261485376
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
##########
@@ -516,6 +505,35 @@ case class DescribeTableCommand(
new MetadataBuilder().putString("comment", "comment of the
column").build())()
)
+ protected def describeSchema(
+ schema: StructType,
+ buffer: ArrayBuffer[Row],
+ header: Boolean): Unit = {
+ if (header) {
+ append(buffer, s"# ${output.head.name}", output(1).name, output(2).name)
+ }
+ schema.foreach { column =>
+ append(buffer, column.name, column.dataType.simpleString,
column.getComment().orNull)
+ }
+ }
+
+ protected def append(
+ buffer: ArrayBuffer[Row], column: String, dataType: String, comment:
String): Unit = {
+ buffer += Row(column, dataType, comment)
+ }
+}
+/**
+ * Command can of the following form.
Review comment:
`can of the` -> `can be the`?
Otherwise, shall we reuse the previous description, `Command that looks
like`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]