This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new 81cb08b7b3a add back a mistakenly removed test case
81cb08b7b3a is described below

commit 81cb08b7b3ae6a4ccfa9787ec39a6041fae8143f
Author: Wenchen Fan <wenc...@databricks.com>
AuthorDate: Wed Sep 7 19:29:39 2022 +0800

    add back a mistakenly removed test case
---
 .../spark/sql/connector/DataSourceV2SQLSuite.scala | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
index 304c77fd003..44f97f55713 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
@@ -2288,6 +2288,30 @@ class DataSourceV2SQLSuite
     }
   }
 
+  test("SPARK-34561: drop/add columns to a dataset of `DESCRIBE TABLE`") {
+    val tbl = s"${catalogAndNamespace}tbl"
+    withTable(tbl) {
+      sql(s"CREATE TABLE $tbl (c0 INT) USING $v2Format")
+      val description = sql(s"DESCRIBE TABLE $tbl")
+      val noCommentDataset = description.drop("comment")
+      val expectedSchema = new StructType()
+        .add(
+          name = "col_name",
+          dataType = StringType,
+          nullable = false,
+          metadata = new MetadataBuilder().putString("comment", "name of the 
column").build())
+        .add(
+          name = "data_type",
+          dataType = StringType,
+          nullable = false,
+          metadata = new MetadataBuilder().putString("comment", "data type of 
the column").build())
+      assert(noCommentDataset.schema === expectedSchema)
+      val isNullDataset = noCommentDataset
+        .withColumn("is_null", noCommentDataset("col_name").isNull)
+      assert(isNullDataset.schema === expectedSchema.add("is_null", 
BooleanType, false))
+    }
+  }
+
   test("SPARK-34576: drop/add columns to a dataset of `DESCRIBE COLUMN`") {
     val tbl = s"${catalogAndNamespace}tbl"
     withTable(tbl) {


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

Reply via email to