huaxingao commented on a change in pull request #34274:
URL: https://github.com/apache/spark/pull/34274#discussion_r728468352
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala
##########
@@ -523,9 +523,11 @@ class SparkSqlAstBuilder extends AstBuilder {
ctx.EXISTS != null,
ctx.REPLACE != null)
} else {
- // Temporary function names should not contain database prefix like
"database.function"
- val database = if (functionIdentifier.length != 1) {
+ if (functionIdentifier.length > 2) {
throw
QueryCompilationErrors.unsupportedFunctionNameError(functionIdentifier.quoted)
+ } else if (functionIdentifier.length == 2) {
+ // Temporary function names should not contain database prefix like
"database.function"
+ throw
QueryCompilationErrors.specifyingDBInCreateTempFuncError(functionIdentifier.head)
Review comment:
I initially combined the two error cases, but the test failed because it
is Expecting an error message `"Specifying a database in CREATE TEMPORARY
FUNCTION is not allowed: 'mydb'"`. I think it is better to have a more specific
error message for `functionIdentifier.length == 2`, so I put it back, just
moving it from `functions.CreateFunctionCommand` to here
--
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]