Skip to content
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-49877][SQL] Change classifyException function signature: add isRuntime argument #48351

Conversation

ivanjevtic-db
Copy link
Contributor

What changes were proposed in this pull request?

The proposal is to update the classifyException function so that it can return either AnalysisException or SparkRuntimeException. This is achieved by adding a new parameter, isRuntime, and modifying the return type to be Throwable with SparkThrowable for compatibility with both types.

Why are the changes needed?

The changes are needed to allow the classifyException function to be used in execution part of the code.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Not needed.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Oct 4, 2024
messageParameters: Map[String, String],
description: String): AnalysisException = {
new AnalysisException(
errorClass = "...",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should assign proper error condition (class) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we're removing it?

*/
def classifyException(
e: Throwable,
errorClass: String,
messageParameters: Map[String, String],
description: String): AnalysisException = {
description: String,
isRuntime: Boolean): Throwable with SparkThrowable = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for back and forth, but do we need this flag now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need it for this pr: #48182(after this is merged I will do some modifications).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

@ivanjevtic-db
Copy link
Contributor Author

The tests are now passing. Could you make a review @MaxGekk? Thanks.

@@ -741,13 +741,15 @@ abstract class JdbcDialect extends Serializable with Logging {
* @param errorClass The error class assigned in the case of an unclassified `e`
* @param messageParameters The message parameters of `errorClass`
* @param description The error description
* @return `AnalysisException` or its sub-class.
* @param isRuntime Whether the exception is a runtime exception or not.
* @return `SparkThrowable + Throwable` or its sub-class.
*/
def classifyException(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method has not been released yet, so, we can modify it.

@MaxGekk
Copy link
Member

MaxGekk commented Oct 7, 2024

+1, LGTM. Merging to master.
Thank you, @ivanjevtic-db.

@MaxGekk MaxGekk closed this in 5132ab1 Oct 7, 2024
himadripal pushed a commit to himadripal/spark that referenced this pull request Oct 19, 2024
…sRuntime argument

### What changes were proposed in this pull request?
The proposal is to update the classifyException function so that it can return either ```AnalysisException``` or ```SparkRuntimeException```. This is achieved by adding a new parameter, ```isRuntime```, and modifying the return type to be ```Throwable with SparkThrowable``` for compatibility with both types.

### Why are the changes needed?
The changes are needed to allow the classifyException function to be used in execution part of the code.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Not needed.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#48351 from ivanjevtic-db/Change-classify-exception-function-signature.

Lead-authored-by: ivanjevtic-db <[email protected]>
Co-authored-by: Ivan Jevtic <[email protected]>
Co-authored-by: milastdbx <[email protected]>
Co-authored-by: Maxim Gekk <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants