MaxGekk commented on code in PR #36220:
URL: https://github.com/apache/spark/pull/36220#discussion_r851722710


##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -388,4 +388,19 @@ class QueryExecutionErrorsSuite extends QueryTest
             |""".stripMargin)
     }
   }
+
+  test("FAILED_EXECUTE_UDF: execute user defined function") {
+    val e1 = intercept[SparkException] {
+      val names = Seq("Jacek", "Agata", "Sweet").toDF("name")
+      val hello = udf { _: String => {
+        throw new SparkException("throw spark exception for udf test")
+      }}
+      names.select(hello($"name")).collect()
+    }
+    assert(e1.getCause.isInstanceOf[SparkException])
+
+    val e2 = e1.getCause.asInstanceOf[SparkException]
+    assert(e2.getErrorClass === "FAILED_EXECUTE_UDF")
+    assert(e2.getMessage.startsWith("Failed to execute user defined function 
"))

Review Comment:
   Please, compare to the entire error message. A purpose is to document errors 
in tests.



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