-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-41435][SQL] Change to call invalidFunctionArgumentsError
for curdate()
when expressions
is not empty
#38960
Conversation
curdate()
throw WRONG_NUM_ARGS
when args is not nullcurdate()
throw WRONG_NUM_ARGS
when args is not empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the error class https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala#L654 and return an internal error instead of it.
There are two questions:
If necessary, I think remove the error class and returning an internal error should be completed in #38940. |
@@ -172,7 +172,7 @@ object CurDateExpressionBuilder extends ExpressionBuilder { | |||
CurrentDate() | |||
} else { | |||
throw QueryCompilationErrors.invalidFunctionArgumentNumberError( | |||
Seq.empty, funcName, expressions.length) | |||
Seq(0), funcName, expressions.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify the intention of this pr, I will change this as
throw QueryCompilationErrors.invalidFunctionArgumentsError(funcName, "0", expressions.length)
and update pr description later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
curdate()
throw WRONG_NUM_ARGS
when args is not emptyinvalidFunctionArgumentsError
for curdate()
when expressions
is not empty
+1, LGTM. Merging to master. |
Thanks @MaxGekk |
… `curdate()` when `expressions` is not empty ### What changes were proposed in this pull request? This pr change to call `invalidFunctionArgumentsError` instead of `invalidFunctionArgumentNumberError ` for `curdate()` when `expressions` is not empty, then `curdate()` will throw `AnalysisException` with error class `WRONG_NUM_ARGS` when input args it not empty. ### Why are the changes needed? `WRONG_NUM_ARGS` is a more appropriate error class ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Add new test case Closes apache#38960 from LuciferYang/curdate-err-msg. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
This pr change to call
invalidFunctionArgumentsError
instead ofinvalidFunctionArgumentNumberError
forcurdate()
whenexpressions
is not empty, thencurdate()
will throwAnalysisException
with error classWRONG_NUM_ARGS
when input args it not empty.Why are the changes needed?
WRONG_NUM_ARGS
is a more appropriate error classDoes this PR introduce any user-facing change?
No
How was this patch tested?
Add new test case