Github user clockfly commented on a diff in the pull request: https://github.com/apache/spark/pull/14850#discussion_r77184294 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala --- @@ -1057,5 +1059,19 @@ case class ScalaUDF( private[this] val converter = CatalystTypeConverters.createToCatalystConverter(dataType) - override def eval(input: InternalRow): Any = converter(f(input)) + val npeErrorMessage = "Given UDF throws NPE during execution, please check the UDF " + + "to make sure it handles null parameters correctly." + + override def eval(input: InternalRow): Any = { + val result = try { + f(input) + } catch { + case e: NullPointerException => --- End diff -- 1. For this code branch `eval(input: InternalRow)`, the existing NPE message should be clear enough if there is a full stacktrace, and the stack contains method of the UDF. 2. The error message you provided can be totally wrong. "Given UDF throws NPE during execution, please check the UDF to make sure it handles null parameters correctly". What if NPE is not caused by parameter? prompting this message is misleading.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org