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-35244][SQL] Invoke should throw the original exception #32370

Closed
wants to merge 1 commit into from

Conversation

cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

This PR updates the interpreted code path of invoke expressions, to unwrap the InvocationTargetException

Why are the changes needed?

Make interpreted and codegen path consistent for invoke expressions.

Does this PR introduce any user-facing change?

no

How was this patch tested?

new UT

@cloud-fan
Copy link
Contributor Author

@viirya @maropu

@github-actions github-actions bot added the SQL label Apr 27, 2021
@SparkQA
Copy link

SparkQA commented Apr 27, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/42522/

@SparkQA
Copy link

SparkQA commented Apr 27, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/42522/

@SparkQA
Copy link

SparkQA commented Apr 27, 2021

Test build #138002 has finished for PR 32370 at commit 56cea5a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon HyukjinKwon changed the title [SPARK-35244][SQL] invoke should throw the original exception [SPARK-35244][SQL] Invoke should throw the original exception Apr 28, 2021
@HyukjinKwon
Copy link
Member

Merged to master.

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

lgtm

@maropu
Copy link
Member

maropu commented Apr 28, 2021

late lgtm.

cloud-fan added a commit that referenced this pull request Apr 28, 2021
### What changes were proposed in this pull request?

This PR updates the interpreted code path of invoke expressions, to unwrap the `InvocationTargetException`

### Why are the changes needed?

Make interpreted and codegen path consistent for invoke expressions.

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

no

### How was this patch tested?

new UT

Closes #32370 from cloud-fan/minor.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: hyukjinkwon <[email protected]>
cloud-fan added a commit that referenced this pull request Apr 28, 2021
### What changes were proposed in this pull request?

This PR updates the interpreted code path of invoke expressions, to unwrap the `InvocationTargetException`

### Why are the changes needed?

Make interpreted and codegen path consistent for invoke expressions.

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

no

### How was this patch tested?

new UT

Closes #32370 from cloud-fan/minor.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: hyukjinkwon <[email protected]>
@cloud-fan
Copy link
Contributor Author

I've backported this to 3.1/3.0, as inconsistency between codegen and interpreted code path is risky.

method.invoke(obj, args: _*)
} catch {
// Re-throw the original exception.
case e: java.lang.reflect.InvocationTargetException => throw e.getCause
Copy link
Member

Choose a reason for hiding this comment

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

nit: a potential NPE 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.

do you mean e.getCause can be null?

Copy link
Member

Choose a reason for hiding this comment

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

right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how the cause can be null for InvocationTargetException, but let me add the null check for safety.

flyrain pushed a commit to flyrain/spark that referenced this pull request Sep 21, 2021
### What changes were proposed in this pull request?

This PR updates the interpreted code path of invoke expressions, to unwrap the `InvocationTargetException`

### Why are the changes needed?

Make interpreted and codegen path consistent for invoke expressions.

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

no

### How was this patch tested?

new UT

Closes apache#32370 from cloud-fan/minor.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: hyukjinkwon <[email protected]>
fishcus pushed a commit to fishcus/spark that referenced this pull request Jan 12, 2022
### What changes were proposed in this pull request?

This PR updates the interpreted code path of invoke expressions, to unwrap the `InvocationTargetException`

### Why are the changes needed?

Make interpreted and codegen path consistent for invoke expressions.

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

no

### How was this patch tested?

new UT

Closes apache#32370 from cloud-fan/minor.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: hyukjinkwon <[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.

6 participants