Shubhambhusate commented on code in PR #53542:
URL: https://github.com/apache/spark/pull/53542#discussion_r2643098728
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala:
##########
@@ -1633,6 +1635,25 @@ class SessionCatalog(
throw
UserDefinedFunctionErrors.notAScalarFunction(function.name.nameParts)
}
(input: Seq[Expression]) => {
+ // Check if any input contains a lambda variable
+ val hasLambdaVar = input.exists { expr =>
+ expr.find {
+ case _: NamedLambdaVariable => true
+ case _: UnresolvedNamedLambdaVariable => true
+ case _ => false
+ }.isDefined
+ }
+ if (hasLambdaVar) {
+ val formattedInputs = input.map {
+ case v: NamedLambdaVariable => "lambda " + v.name
+ case v: UnresolvedNamedLambdaVariable => "lambda " + v.name
+ case e => e.sql
+ }.mkString(", ")
+ throw new AnalysisException(
+ errorClass = "UNSUPPORTED_FEATURE.LAMBDA_FUNCTION_WITH_SQL_UDF",
+ messageParameters = Map(
+ "funcName" -> ("\"" + function.name.unquotedString + "(" +
formattedInputs + ")\"")))
+ }
Review Comment:
As @cloud-fan mentioned that we don't include the function inputs in the
error message. So i have removed it.
--
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]