imback82 commented on code in PR #45077:
URL: https://github.com/apache/spark/pull/45077#discussion_r1495160039


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DescribeTableSuiteBase.scala:
##########
@@ -178,4 +178,43 @@ trait DescribeTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
       assert(errMsg === "DESC TABLE COLUMN does not support nested column: 
col.x.")
     }
   }
+
+  test("describe a clustered table") {
+    withNamespaceAndTable("ns", "tbl") { tbl =>
+      sql(s"CREATE TABLE $tbl (col1 STRING, col2 INT) $defaultUsing CLUSTER BY 
(col1, col2)")
+      val descriptionDf = sql(s"DESC $tbl")
+      assert(descriptionDf.schema.map(field => (field.name, field.dataType)) 
=== Seq(
+        ("col_name", StringType),
+        ("data_type", StringType),
+        ("comment", StringType)))
+      QueryTest.checkAnswer(
+        descriptionDf,
+        Seq(
+          Row("col1", "string", null),
+          Row("col2", "int", null),
+          Row("# Clustering Information", "", ""),
+          Row("# col_name", "data_type", "comment"),
+          Row("col1", "string", null),
+          Row("col2", "int", null)))
+    }
+  }
+
+  test("describe a clustered table with comments on clustering columns") {
+    withNamespaceAndTable("ns", "tbl") { tbl =>
+      sql(s"CREATE TABLE $tbl (col1 STRING) $defaultUsing CLUSTER BY (col1)")
+      sql(s"ALTER TABLE $tbl ALTER COLUMN col1 COMMENT 'this is comment';")

Review Comment:
   done. also added a nested column case.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to