Skip to content

[SPARK-45093][CONNECT][PYTHON] Properly support error handling and conversion for AddArtifactHandler #44092

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

Closed

Conversation

grundprinzip
Copy link
Contributor

@grundprinzip grundprinzip commented Nov 30, 2023

What changes were proposed in this pull request?

This patch improves the error handling when errors are happening in the AddArtifact path. In particular, the AddArtifactHandler would not properly return exceptions but all exceptions would end up yielding UNKNOWN errors. This patch makes sure we wrap the errors in the add artifact path the same way as we're wrapping the errors in the normal query execution path.

In addition, it adds tests and verification for this behavior in Scala and in Python.

Why are the changes needed?

Stability

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added UT for Scala and Python

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

No

@grundprinzip grundprinzip changed the title [SPARK-XXXX]Properly support error handling and conversion for AddArt… [SPARK-XXXX]Properly support error handling and conversion for AddArtifactHandler Nov 30, 2023
@grundprinzip grundprinzip changed the title [SPARK-XXXX]Properly support error handling and conversion for AddArtifactHandler [SPARK-45093]Properly support error handling and conversion for AddArtifactHandler Nov 30, 2023
@grundprinzip
Copy link
Contributor Author

@hvanhovell @HyukjinKwon PTAL

@HyukjinKwon HyukjinKwon changed the title [SPARK-45093]Properly support error handling and conversion for AddArtifactHandler [SPARK-45093][CONNECT][PYTHON] Properly support error handling and conversion for AddArtifactHandler Dec 1, 2023
@HyukjinKwon
Copy link
Member

HyukjinKwon commented Dec 1, 2023

cc @juliuszsompolski @cdkrot @heyihong mind taking a look please?

Copy link
Contributor

@heyihong heyihong left a comment

Choose a reason for hiding this comment

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

LGTM

val partial: PartialFunction[Throwable, Throwable] = {
case e: Throwable if e.isInstanceOf[SparkThrowable] || NonFatal.apply(e) =>
StatusProto.toStatusRuntimeException(buildStatusFromThrowable(e, sessionHolderOpt))
case e: StatusRuntimeException => e
Copy link
Contributor

Choose a reason for hiding this comment

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

this case is not present in the query handleError, why it's a case needed 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.

In the original query error case, I was very certain that the error conversion does not happen inside the try block. Let me research why I added this (or if I was just cautious)

@HyukjinKwon
Copy link
Member

Merged to master.

asl3 pushed a commit to asl3/spark that referenced this pull request Dec 5, 2023
…nversion for AddArtifactHandler

### What changes were proposed in this pull request?
This patch improves the error handling when errors are happening in the `AddArtifact` path. In particular, the `AddArtifactHandler` would not properly return exceptions but all exceptions would end up yielding `UNKNOWN` errors. This patch makes sure we wrap the errors in the add artifact path the same way as we're wrapping the errors in the normal query execution path.

In addition, it adds tests and verification for this behavior in Scala and in Python.

### Why are the changes needed?
Stability

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

### How was this patch tested?
Added UT for Scala and Python

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

Closes apache#44092 from grundprinzip/SPARK-ADD_ARTIFACT_CRAP.

Authored-by: Martin Grund <martin.grund@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
dbatomic pushed a commit to dbatomic/spark that referenced this pull request Dec 11, 2023
…nversion for AddArtifactHandler

### What changes were proposed in this pull request?
This patch improves the error handling when errors are happening in the `AddArtifact` path. In particular, the `AddArtifactHandler` would not properly return exceptions but all exceptions would end up yielding `UNKNOWN` errors. This patch makes sure we wrap the errors in the add artifact path the same way as we're wrapping the errors in the normal query execution path.

In addition, it adds tests and verification for this behavior in Scala and in Python.

### Why are the changes needed?
Stability

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

### How was this patch tested?
Added UT for Scala and Python

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

Closes apache#44092 from grundprinzip/SPARK-ADD_ARTIFACT_CRAP.

Authored-by: Martin Grund <martin.grund@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants