You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/07 07:11:02 UTC
[GitHub] [spark] LuciferYang opened a new pull request, #38960: [SPARK-41435][SQL] Make `curdate()` throw `WRONG_NUM_ARGS ` when args is not null
LuciferYang opened a new pull request, #38960:
URL: https://github.com/apache/spark/pull/38960
### What changes were proposed in this pull request?
`curdate()` throw `QueryCompilationErrors.invalidFunctionArgumentNumberError` with `Seq.empty` input when `expressions` is not empty, then the error class will be `_LEGACY_ERROR_TEMP_1043 `:
```json
"_LEGACY_ERROR_TEMP_1043" : {
"message" : [
"Invalid arguments for function <name>."
]
}
```
this pr change the first input arg from `Seq.empty` to `Seq(0)` to make the error class use `WRONG_NUM_ARGS`:
```json
"WRONG_NUM_ARGS" : {
"message" : [
"The <functionName> requires <expectedNum> parameters but the actual number is <actualNum>."
]
}
```
### 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
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on pull request #38960: [SPARK-41435][SQL] Change to call `invalidFunctionArgumentsError` for `curdate()` when `expressions` is not empty
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #38960:
URL: https://github.com/apache/spark/pull/38960#issuecomment-1342684206
Thanks @MaxGekk
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on pull request #38960: [SPARK-41435][SQL] Make `curdate()` throw `WRONG_NUM_ARGS ` when args is not empty
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #38960:
URL: https://github.com/apache/spark/pull/38960#issuecomment-1341907393
There are two questions:
1. When `validParametersCount.length == 0`, should an internal exception be thrown? I think `validParametersCount.length == 0` should only be because it does not match the appropriate constructor, as I described in https://github.com/apache/spark/pull/38940#discussion_r1041778431.
3. `select curdate(1)` looks like a user usage exception. I don't think it should enter the `validParametersCount.length == 0` branch
I think deleting remove the error class and returning an internal error should be completed in https://github.com/apache/spark/pull/38940.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk closed pull request #38960: [SPARK-41435][SQL] Change to call `invalidFunctionArgumentsError` for `curdate()` when `expressions` is not empty
Posted by GitBox <gi...@apache.org>.
MaxGekk closed pull request #38960: [SPARK-41435][SQL] Change to call `invalidFunctionArgumentsError` for `curdate()` when `expressions` is not empty
URL: https://github.com/apache/spark/pull/38960
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on pull request #38960: [SPARK-41435][SQL] Change to call `invalidFunctionArgumentsError` for `curdate()` when `expressions` is not empty
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #38960:
URL: https://github.com/apache/spark/pull/38960#issuecomment-1342669615
+1, LGTM. Merging to master.
Thank you, @LuciferYang.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on a diff in pull request #38960: [SPARK-41435][SQL] Make `curdate()` throw `WRONG_NUM_ARGS ` when args is not empty
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on code in PR #38960:
URL: https://github.com/apache/spark/pull/38960#discussion_r1042889334
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -172,7 +172,7 @@ object CurDateExpressionBuilder extends ExpressionBuilder {
CurrentDate()
} else {
throw QueryCompilationErrors.invalidFunctionArgumentNumberError(
- Seq.empty, funcName, expressions.length)
+ Seq(0), funcName, expressions.length)
Review Comment:
To clarify the intention of this pr, I will change this as
```scala
throw QueryCompilationErrors.invalidFunctionArgumentsError(funcName, "0", expressions.length)
```
and update pr description later
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on a diff in pull request #38960: [SPARK-41435][SQL] Make `curdate()` throw `WRONG_NUM_ARGS ` when args is not empty
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on code in PR #38960:
URL: https://github.com/apache/spark/pull/38960#discussion_r1042889334
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -172,7 +172,7 @@ object CurDateExpressionBuilder extends ExpressionBuilder {
CurrentDate()
} else {
throw QueryCompilationErrors.invalidFunctionArgumentNumberError(
- Seq.empty, funcName, expressions.length)
+ Seq(0), funcName, expressions.length)
Review Comment:
To clarify the intention of this pr, I will change this as
```scala
throw QueryCompilationErrors.invalidFunctionArgumentsError(funcName, "0", expressions.length)
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on a diff in pull request #38960: [SPARK-41435][SQL] Change to call `invalidFunctionArgumentsError` for `curdate()` when `expressions` is not empty
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on code in PR #38960:
URL: https://github.com/apache/spark/pull/38960#discussion_r1042948569
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -172,7 +172,7 @@ object CurDateExpressionBuilder extends ExpressionBuilder {
CurrentDate()
} else {
throw QueryCompilationErrors.invalidFunctionArgumentNumberError(
- Seq.empty, funcName, expressions.length)
+ Seq(0), funcName, expressions.length)
Review Comment:
done
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org