beliefer commented on a change in pull request #31052:
URL: https://github.com/apache/spark/pull/31052#discussion_r553699854



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala
##########
@@ -1178,19 +1179,19 @@ case class ScalaUDF(
 
   private[this] val resultConverter = catalystConverter
 
-  lazy val udfErrorMessage = {
-    val funcCls = Utils.getSimpleName(function.getClass)
-    val inputTypes = children.map(_.dataType.catalogString).mkString(", ")
-    val outputType = dataType.catalogString
-    s"Failed to execute user defined function($funcCls: ($inputTypes) => 
$outputType)"
+  lazy val (funcCls, inputTypesString, outputType) = {
+    (Utils.getSimpleName(function.getClass),
+      children.map(_.dataType.catalogString).mkString(", "),
+      dataType.catalogString)
   }
 
   override def eval(input: InternalRow): Any = {
     val result = try {
       f(input)
     } catch {
       case e: Exception =>
-        throw new SparkException(udfErrorMessage, e)
+        throw QueryExecutionErrors.failedExecuteUserDefinedFunctionError(
+          funcCls, inputTypesString, outputType, e)

Review comment:
       Because we want group exception messages in `QueryExecutionErrors`. We 
should write msg into `QueryExecutionErrors`.




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

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