-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-40760][SQL] Migrate type check failures of interval expressions onto error classes #38237
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
|
@cloud-fan @itholic Please, take a look at it. |
amaliujia
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.
LGTM
| }, | ||
| "WRONG_NUM_ENDPOINTS" : { | ||
| "message" : [ | ||
| "The number of endpoints must be >= 2 to construct intervals." |
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.
Nit: maybe also include what is current num but this is minor.
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
itholic
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.
+1. LGTM
|
@cloud-fan Could you approve this PR, please. |
| "The <functionName> accepts only arrays of pair structs, but <childExpr> is of <childType>." | ||
| ] | ||
| }, | ||
| "NON_FOLDABLE_ENDPOINT" : { |
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.
Can NON_FOLDABLE_INPUT be reused?
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.
| }, | ||
| "UNEXPECTED_ENDPOINT_TYPE" : { | ||
| "message" : [ | ||
| "Endpoints require (numeric or \"TIMESTAMP\" or \"DATE\" or \"TIMESTAMP_NTZ\" or \"INTERVAL YEAR TO MONTH\" or \"INTERVAL DAY TO SECOND\") type." |
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.
Can UNEXPECTED_INPUT_TYPE be reused?
Or Should we change numeric or \"TIMESTAMP\" or \"DATE\" or \"TIMESTAMP_NTZ\" or \"INTERVAL YEAR TO MONTH\" or \"INTERVAL DAY TO SECOND\" to a placeholder?
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
| "The <exprName> must be between <valueRange> (current value = <currentValue>)" | ||
| ] | ||
| }, | ||
| "WRONG_NUM_ENDPOINTS" : { |
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.
Can WRONG_NUM_PARAMS be reused?
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.
I would leave this as is because this is not about wrong number of parameters but about endpoints in a parameter.
LuciferYang
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.
+1, LGTM if test pass
|
@cloud-fan Could you approve the PR, please. |
|
Merging to master. Thank you, @itholic @LuciferYang @amaliujia for review. |
…s onto error classes ### What changes were proposed in this pull request? In the PR, I propose to add new error sub-classes of the error class `DATATYPE_MISMATCH`, and use it in the case of type check failures of some interval expressions. ### Why are the changes needed? Migration onto error classes unifies Spark SQL error messages, and improves search-ability of errors. ### Does this PR introduce _any_ user-facing change? Yes. The PR changes user-facing error messages. ### How was this patch tested? By running the affected test suites: ``` $ build/sbt "test:testOnly *AnalysisSuite" $ build/sbt "test:testOnly *ExpressionTypeCheckingSuite" $ build/sbt "test:testOnly *ApproxCountDistinctForIntervalsSuite" ``` Closes apache#38237 from MaxGekk/type-check-fails-interval-exprs. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
In the PR, I propose to add new error sub-classes of the error class
DATATYPE_MISMATCH, and use it in the case of type check failures of some interval expressions.Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages, and improves search-ability of errors.
Does this PR introduce any user-facing change?
Yes. The PR changes user-facing error messages.
How was this patch tested?
By running the affected test suites: