philo-he commented on code in PR #12493:
URL: https://github.com/apache/gluten/pull/12493#discussion_r3574523874


##########
gluten-ut/spark40/src/test/scala/org/apache/spark/sql/connector/GlutenGroupBasedUpdateTableSuite.scala:
##########
@@ -16,8 +16,34 @@
  */
 package org.apache.spark.sql.connector
 
+import org.apache.spark.SparkException
 import org.apache.spark.sql.GlutenSQLTestsTrait
 
 class GlutenGroupBasedUpdateTableSuite
   extends GroupBasedUpdateTableSuite
-  with GlutenSQLTestsTrait {}
+  with GlutenSQLTestsTrait {
+
+  private def assertNotNullViolation(f: => Unit): Unit = {
+    val exception = intercept[SparkException](f)
+    val messages = Iterator
+      .iterate[Throwable](exception)(_.getCause)
+      .takeWhile(_ != null)
+      .flatMap(e => Option(e.getMessage))
+
+    assert(messages.exists(_.contains("Null value appeared in non-nullable 
field")))
+  }
+
+  testGluten("update with NOT NULL checks") {
+    createAndInitTable(
+      "pk INT NOT NULL, s STRUCT<n_i: INT NOT NULL, n_l: LONG>, dep STRING",
+      """{ "pk": 1, "s": { "n_i": 1, "n_l": 11 }, "dep": "hr" }
+        |{ "pk": 2, "s": { "n_i": 2, "n_l": 22 }, "dep": "software" }
+        |{ "pk": 3, "s": { "n_i": 3, "n_l": 33 }, "dep": "hr" }
+        |""".stripMargin
+    )
+
+    assertNotNullViolation {

Review Comment:
   Can we override Spark's checkError in this test suite? 



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

Reply via email to