beliefer commented on code in PR #42245:
URL: https://github.com/apache/spark/pull/42245#discussion_r1280172761
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/expressions/UserDefinedFunction.scala:
##########
@@ -144,6 +146,25 @@ case class ScalarUserDefinedFunction private[sql] (
}
object ScalarUserDefinedFunction {
+ private val LAMBDA_DESERIALIZATION_ERR_MSG: String =
+ "cannot assign instance of java.lang.invoke.SerializedLambda to field"
+
+ private def checkDeserializable(bytes: Array[Byte]): Unit = {
+ try {
+ SparkSerDeUtils.deserialize(bytes,
SparkClassUtils.getContextOrSparkClassLoader)
+ } catch {
+ case e: ClassCastException if
e.getMessage.contains(LAMBDA_DESERIALIZATION_ERR_MSG) =>
+ throw new SparkException(
+ "UDF cannot be executed on a Spark cluster: it cannot be
deserialized. " +
+ "This is very likely to be caused by the lambda function (the UDF)
having a "
Review Comment:
It seems better to use `"""..."""`.
--
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]