robreeves commented on code in PR #41599:
URL: https://github.com/apache/spark/pull/41599#discussion_r1235598544
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -396,20 +396,42 @@ class QueryExecutionErrorsSuite
sqlState = "22023")
}
+ test("FAILED_EXECUTE_UDF: execute user defined function with registered
UDF") {
+ val luckyCharOfWord = udf { (word: String, index: Int) => {
+ word.substring(index, index + 1)
+ }}
+ spark.udf.register("luckyCharOfWord", luckyCharOfWord)
+
+ val e = intercept[SparkException] {
+ Seq(("Jacek", 5), ("Agata", 5), ("Sweet", 6))
+ .toDF("word", "index")
+ .createOrReplaceTempView("words")
+ spark.sql("select luckyCharOfWord(word, index) from words").collect()
+ }
+ assert(e.getCause.isInstanceOf[SparkException])
+
+ checkError(
+ exception = e.getCause.asInstanceOf[SparkException],
+ errorClass = "FAILED_EXECUTE_UDF",
+ parameters = Map(
+ "functionName" -> "luckyCharOfWord
\\(QueryExecutionErrorsSuite\\$\\$Lambda\\$\\d+/\\w+\\)",
Review Comment:
Updated
--
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]