cloud-fan commented on a change in pull request #30881:
URL: https://github.com/apache/spark/pull/30881#discussion_r549936158
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
##########
@@ -154,13 +154,54 @@ class DataSourceV2SQLSuite
Array("Table Properties", "[bar=baz]", "")))
}
- test("Describe column is not supported for v2 catalog") {
- withTable("testcat.tbl") {
- spark.sql("CREATE TABLE testcat.tbl (id bigint) USING foo")
- val ex = intercept[AnalysisException] {
- spark.sql("DESCRIBE testcat.tbl id")
+ test("Describe column for v2 catalog") {
+ val t = "testcat.tbl"
+ withTable(t) {
+ sql(s"CREATE TABLE $t (id bigint, data string COMMENT 'hello') USING
foo")
+ val df1 = sql(s"DESCRIBE $t id")
+ assert(df1.schema.map(field => (field.name, field.dataType))
+ === Seq(("info_name", StringType), ("info_value", StringType)))
+ assert(df1.collect === Seq(
+ Row("col_name", "id"),
+ Row("data_type", "bigint"),
+ Row("comment", "NULL")))
+ val df2 = sql(s"DESCRIBE $t data")
+ assert(df2.schema.map(field => (field.name, field.dataType))
+ === Seq(("info_name", StringType), ("info_value", StringType)))
+ assert(df2.collect === Seq(
+ Row("col_name", "data"),
+ Row("data_type", "string"),
+ Row("comment", "hello")))
+
+ assertAnalysisError(
+ s"DESCRIBE $t invalid_col",
+ "cannot resolve '`invalid_col`' given input columns:
[testcat.tbl.data, testcat.tbl.id]")
Review comment:
I think v2 is better. Let's keep it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]