srielau commented on code in PR #50290:
URL: https://github.com/apache/spark/pull/50290#discussion_r1997858764
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/DescribeTableSuite.scala:
##########
@@ -424,6 +424,58 @@ trait DescribeTableSuiteBase extends
command.DescribeTableSuiteBase
}
}
+ test("DESCRIBE AS JSON collation") {
+ withNamespaceAndTable("ns", "table") { t =>
+ val tableCreationStr =
+ s"""
+ |CREATE TABLE $t (
+ | c1 STRING COLLATE UNICODE_CI,
+ | c2 STRING COLLATE UNICODE_RTRIM,
+ | c3 STRING COLLATE FR,
+ | c4 STRING,
+ | id INT
+ |)
+ |USING parquet COMMENT 'table_comment'
+ |""".stripMargin
+ spark.sql(tableCreationStr)
+
+ val descriptionDf = spark.sql(s"DESC EXTENDED $t AS JSON")
+ val firstRow = descriptionDf.select("json_metadata").head()
+ val jsonValue = firstRow.getString(0)
+ val parsedOutput = parse(jsonValue).extract[DescribeTableJson]
+
+ val expectedOutput = DescribeTableJson(
+ table_name = Some("table"),
+ catalog_name = Some("spark_catalog"),
+ namespace = Some(List("ns")),
+ schema_name = Some("ns"),
+ columns = Some(List(
+ TableColumn("c1", Type("string", collation = Some("UNICODE_CI"))),
+ TableColumn("c2", Type("string", collation = Some("UNICODE_RTRIM"))),
+ TableColumn("c3", Type("string", collation = Some("fr"))),
Review Comment:
Curious, why is the case not normalized? For builtin collations they should
be, no?
--
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]