-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41435][SQL] Change to call invalidFunctionArgumentsError for curdate() when expressions is not empty
#38960
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
Conversation
curdate() throw WRONG_NUM_ARGS when args is not nullcurdate() throw WRONG_NUM_ARGS when args is not empty
MaxGekk
left a comment
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. |
| } 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 <[email protected]> Signed-off-by: Max Gekk <[email protected]>
What changes were proposed in this pull request?
This pr change to call
invalidFunctionArgumentsErrorinstead ofinvalidFunctionArgumentNumberErrorforcurdate()whenexpressionsis not empty, thencurdate()will throwAnalysisExceptionwith error classWRONG_NUM_ARGSwhen input args it not empty.Why are the changes needed?
WRONG_NUM_ARGSis a more appropriate error classDoes this PR introduce any user-facing change?
No
How was this patch tested?
Add new test case