You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2024/02/15 13:05:30 UTC

Re: [PR] [SPARK-45789][SQL] Support DESCRIBE TABLE for clustering columns [spark]

cloud-fan commented on code in PR #45077:
URL: https://github.com/apache/spark/pull/45077#discussion_r1490980421


##########
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:
   since we only want to test DESCRIBE TABLE, not ATLER COLUMN, shall we specify the column comment in CREATE TABLE? then we don't need to exclude this test case in the hive test.



-- 
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-unsubscribe@spark.apache.org

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


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