ivoson commented on code in PR #36064: URL: https://github.com/apache/spark/pull/36064#discussion_r846604930
########## sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala: ########## @@ -168,4 +172,115 @@ class QueryCompilationErrorsSuite extends QueryTest with SharedSparkSession { "The feature is not supported: " + "Pandas UDF aggregate expressions don't support pivot.") } + + test("NO_HANDLER_FOR_UDAF: No handler for UDAF error") { + val functionName = "myCast" + withUserDefinedFunction(functionName -> true) { + sql( + s""" + |CREATE TEMPORARY FUNCTION $functionName + |AS 'org.apache.spark.sql.errors.MyCastToString' + |""".stripMargin) + + val e = intercept[AnalysisException] ( + sql("SELECT myCast(123) as value") + ) + + assert(e.errorClass === Some("NO_HANDLER_FOR_UDAF")) + assert(e.message === + s"No handler for UDAF 'org.apache.spark.sql.errors.MyCastToString'. " + + s"Use sparkSession.udf.register(...) instead.") Review Comment: Thanks, will fix. -- 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