Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19822#discussion_r153080840
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala
---
@@ -1050,17 +1050,17 @@ case class ScalaUDF(
throw new
org.apache.spark.SparkException($scalaUDF.udfErrorMessage(), e);
}
"""
-
+ val nullSafeCode = ctx.nullSafeExec(nullable, ev.isNull) {
+ s"${ev.value} = $resultTerm;"
+ }
ev.copy(code = s"""
$evalCode
${converters.mkString("\n")}
$callFunc
boolean ${ev.isNull} = $resultTerm == null;
${ctx.javaType(dataType)} ${ev.value} =
${ctx.defaultValue(dataType)};
- if (!${ev.isNull}) {
- ${ev.value} = $resultTerm;
- }""")
+ $nullSafeCode""")
--- End diff --
I do not like this parameter name. It is meaningless.
Maybe you can close this PR? It does not help either code readability or
performance
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]