-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-39214][SQL][3.3] Improve errors related to CAST #36591
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the PR, I propose to rename the error classes: 1. INVALID_SYNTAX_FOR_CAST -> CAST_INVALID_INPUT 2. CAST_CAUSES_OVERFLOW -> CAST_OVERFLOW and change error messages: CAST_INVALID_INPUT: `The value <value> of the type <sourceType> cannot be cast to <targetType> because it is malformed. ...` CAST_OVERFLOW: `The value <value> of the type <sourceType> cannot be cast to <targetType> due to an overflow....` Also quote the SQL config `"spark.sql.ansi.enabled"` and a function name. To improve user experience with Spark SQL by making errors/error classes related to CAST more clear and **unified**. Yes, the PR changes user-facing error messages. By running the modified test suites: ``` $ build/sbt "testOnly *CastSuite" $ build/sbt "test:testOnly *DateFormatterSuite" $ build/sbt "test:testOnly *TimestampFormatterSuite" $ build/sbt "testOnly *DSV2SQLInsertTestSuite" $ build/sbt "test:testOnly *InsertSuite" $ build/sbt "testOnly *AnsiCastSuiteWithAnsiModeOff" ``` Closes apache#36553 from MaxGekk/error-class-improve-msg-2. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com> (cherry picked from commit 66648e9) Signed-off-by: Max Gekk <max.gekk@gmail.com>
gengliangwang
approved these changes
May 18, 2022
dongjoon-hyun
approved these changes
May 18, 2022
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 (Pending CIs)
Merging to 3.3. Thank you, @gengliangwang and @dongjoon-hyun for review. |
MaxGekk
added a commit
that referenced
this pull request
May 18, 2022
### What changes were proposed in this pull request? In the PR, I propose to rename the error classes: 1. INVALID_SYNTAX_FOR_CAST -> CAST_INVALID_INPUT 2. CAST_CAUSES_OVERFLOW -> CAST_OVERFLOW and change error messages: CAST_INVALID_INPUT: `The value <value> of the type <sourceType> cannot be cast to <targetType> because it is malformed. ...` CAST_OVERFLOW: `The value <value> of the type <sourceType> cannot be cast to <targetType> due to an overflow....` Also quote the SQL config `"spark.sql.ansi.enabled"` and a function name. This is a backport of #36553. ### Why are the changes needed? To improve user experience with Spark SQL by making errors/error classes related to CAST more clear and **unified**. ### Does this PR introduce _any_ user-facing change? Yes, the PR changes user-facing error messages. ### How was this patch tested? By running the modified test suites: ``` $ build/sbt "testOnly *CastSuite" $ build/sbt "test:testOnly *DateFormatterSuite" $ build/sbt "test:testOnly *TimestampFormatterSuite" $ build/sbt "testOnly *DSV2SQLInsertTestSuite" $ build/sbt "test:testOnly *InsertSuite" $ build/sbt "testOnly *AnsiCastSuiteWithAnsiModeOff" ``` Authored-by: Max Gekk <max.gekkgmail.com> Signed-off-by: Max Gekk <max.gekkgmail.com> (cherry picked from commit 66648e9) Signed-off-by: Max Gekk <max.gekkgmail.com> Closes #36591 from MaxGekk/error-class-improve-msg-2-3.3. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
In the PR, I propose to rename the error classes:
and change error messages:
CAST_INVALID_INPUT:
The value <value> of the type <sourceType> cannot be cast to <targetType> because it is malformed. ...
CAST_OVERFLOW:
The value <value> of the type <sourceType> cannot be cast to <targetType> due to an overflow....
Also quote the SQL config
"spark.sql.ansi.enabled"
and a function name.This is a backport of #36553.
Why are the changes needed?
To improve user experience with Spark SQL by making errors/error classes related to CAST more clear and unified.
Does this PR introduce any user-facing change?
Yes, the PR changes user-facing error messages.
How was this patch tested?
By running the modified test suites:
Authored-by: Max Gekk max.gekk@gmail.com
Signed-off-by: Max Gekk max.gekk@gmail.com
(cherry picked from commit 66648e9)
Signed-off-by: Max Gekk max.gekk@gmail.com