aokolnychyi commented on code in PR #50271:
URL: https://github.com/apache/spark/pull/50271#discussion_r2008250871


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DeleteFromTableSuiteBase.scala:
##########
@@ -24,6 +24,84 @@ abstract class DeleteFromTableSuiteBase extends 
RowLevelOperationSuiteBase {
 
   import testImplicits._
 
+  test("delete from table containing added column with default value") {
+    createAndInitTable("pk INT NOT NULL, dep STRING", """{ "pk": 1, "dep": 
"hr" }""")
+
+    sql(s"ALTER TABLE $tableNameAsString ADD COLUMN txt STRING DEFAULT 
'initial-text'")
+
+    append("pk INT, dep STRING",
+      """{ "pk": 2, "dep": "hr" }
+        |{ "pk": 3, "dep": "software" }
+        |{ "pk": 4, "dep": "hr" }
+        |""".stripMargin)
+
+    sql(s"ALTER TABLE $tableNameAsString ALTER COLUMN txt SET DEFAULT 
'new-text'")
+
+    append("pk INT, dep STRING",
+      """{ "pk": 5, "dep": "hr" }
+        |{ "pk": 6, "dep": "hr" }
+        |""".stripMargin)
+
+    checkAnswer(
+      sql(s"SELECT * FROM $tableNameAsString"),
+      Seq(
+        Row(1, "hr", "initial-text"),
+        Row(2, "hr", "initial-text"),
+        Row(3, "software", "initial-text"),
+        Row(4, "hr", "initial-text"),
+        Row(5, "hr", "new-text"),
+        Row(6, "hr", "new-text")))
+
+    sql(s"DELETE FROM $tableNameAsString WHERE pk IN (2, 5)")
+
+    checkAnswer(
+      sql(s"SELECT * FROM $tableNameAsString"),
+      Seq(
+        Row(1, "hr", "initial-text"),
+        Row(3, "software", "initial-text"),
+        Row(4, "hr", "initial-text"),
+        Row(6, "hr", "new-text")))
+  }
+
+  test("delete from table containing struct column with default value") {

Review Comment:
   It felt sufficient to test here as there is no special logic for structs.



-- 
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