-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-38131][SQL] Use error classes in user-facing exceptions only #35445
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-38131][SQL] Use error classes in user-facing exceptions only #35445
Conversation
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
Outdated
Show resolved
Hide resolved
| """.stripMargin.trim + " of the field in the target object") | ||
| } | ||
|
|
||
| test("UNSUPPORTED_FEATURE: UpCast only support DecimalType as AbstractDataType") { |
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.
The test was added by #35366 recently while porting on error classes. So, it is safe to remove it.
| result | ||
| } else { | ||
| throw QueryExecutionErrors.rowFromCSVParserNotExpectedError | ||
| throw new IllegalStateException("Expected one row from CSV parser.") |
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 do believe this shouldn't happen. cc @HyukjinKwon
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
|
|
||
| case UpCast(_, target, _) if target != DecimalType && !target.isInstanceOf[DataType] => | ||
| throw QueryCompilationErrors.unsupportedAbstractDataTypeForUpCastError(target) | ||
| throw new AnalysisException( |
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.
For internal errors, can we throw IllegalStateException?
|
Merging to master. Thank you, @HyukjinKwon and @cloud-fan for review. |
What changes were proposed in this pull request?
In the PR, I propose to remove the error class
ROW_FROM_CSV_PARSER_NOT_EXPECTEDand don't use the error classUNSUPPORTED_FEATUREin an up-cast exception which is an internal one.Why are the changes needed?
The error classes are supposed to be used in user-facing errors/exceptions only. It doesn't make sense to introduce/use them in internal errors.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
By running existing test suites.