anchovYu commented on code in PR #41429:
URL: https://github.com/apache/spark/pull/41429#discussion_r1228808365
##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1580,6 +1580,11 @@
"Not allowed to implement multiple UDF interfaces, UDF class
<className>."
]
},
+ "NAMED_ARGUMENTS_SUPPORT_DISABLED" : {
+ "message" : [
+ "Named arguments support is currently disabled. Enable suppport using
ALLOW_NAMED_FUNCTION_ARGUMENTS."
Review Comment:
Should write the full name of the configuration:
`spark.sql.allowNamedFunctionArguments`.
##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1580,6 +1580,11 @@
"Not allowed to implement multiple UDF interfaces, UDF class
<className>."
]
},
+ "NAMED_ARGUMENTS_SUPPORT_DISABLED" : {
+ "message" : [
+ "Cannot call function ‘<functionName>’ because named argument references
are not supported here. In this case, the named argument reference was
‘<argument>’.\n"
Review Comment:
```suggestion
"Cannot call function <functionName> because named argument references
are not supported here. In this case, the named argument reference was
<argument>"
```
We should avoid quoting directly in the error message. Instead, in the
`sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala`,
try to wrap those idenfitiers using `toSQLId`.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -193,6 +193,13 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase {
messageParameters = Map("configKey" -> configKey))
}
+ def namedArgumentsNotEnabledError(argumentName: String): Throwable = {
+ new AnalysisException(
+ errorClass = "NAMED_ARGUMENTS_SUPPORT_DISABLED",
+ messageParameters = Map("message" -> (argumentName + " is a named
argument."))
Review Comment:
This error class doesn't have any message parameters `<message>`, the map
should be empty.
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala:
##########
@@ -20,16 +20,27 @@ package org.apache.spark.sql.errors
import org.apache.spark.SparkThrowable
import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.catalyst.parser.ParseException
+import org.apache.spark.sql.catalyst.plans.SQLHelper
import org.apache.spark.sql.test.SharedSparkSession
// Turn of the length check because most of the tests check entire error
messages
// scalastyle:off line.size.limit
-class QueryParsingErrorsSuite extends QueryTest with SharedSparkSession {
+class QueryParsingErrorsSuite extends QueryTest with SharedSparkSession with
SQLHelper {
private def parseException(sqlText: String): SparkThrowable = {
intercept[ParseException](sql(sqlText).collect())
}
+ test("NAMED_ARGUMENTS_SUPPORT_DISABLED: named arguments not turned on") {
+ withSQLConf("spark.sql.allowNamedFunctionArguments" -> "false") {
+ checkError(
+ exception = parseException("SELECT * FROM encode(value => 'abc',
charset => 'utf-8')"),
Review Comment:
Could you add an extra test for TVF?
--
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]