dtenedor commented on code in PR #41429:
URL: https://github.com/apache/spark/pull/41429#discussion_r1227338001
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -1544,8 +1544,22 @@ class AstBuilder extends
SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit
if (name.length > 1) {
throw QueryParsingErrors.invalidTableValuedFunctionNameError(name,
ctx)
}
+ val args = func.functionArgument.asScala.map { e =>
+ Option(e.namedArgumentExpression).map { n =>
+ if (SQLConf.get.getConf(SQLConf.ALLOW_NAMED_FUNCTION_ARGUMENTS)) {
+ NamedArgumentExpression(n.key.getText, expression(n.value))
+ } else {
+ throw new ParseException(
+ errorClass = "Named arguments not enabled.",
Review Comment:
This is not quite how the error classes work :) instead you need to:
1. Add a new entry in error-classes.json [1]
2. Add a corresponding function in QueryCompilationErrors.scala [2]
3. Call that function here like `throw
QueryCompilationErrors.namedArgumentsNotEnabled(n.key.getText)`
4. Exercise this behavior in a unit test to make sure we really get this
error message if the configuration is not enabled.
[1]
https://github.com/apache/spark/blob/master/core/src/main/resources/error/error-classes.json#L1326
[2]
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
--
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]