Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Oct 22, 2016

What changes were proposed in this pull request?

On null next exception in JDBC, don't init it as cause or suppressed

How was this patch tested?

Existing tests

@SparkQA
Copy link

SparkQA commented Oct 22, 2016

Test build #67381 has finished for PR 15599 at commit 231223f.

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

@gatorsmile
Copy link
Member

If we do not have a test case, could you post the exception before the fix and the exception output after the fix? Thanks!

@maver1ck
Copy link
Contributor

I can try this fix on Monday.

@srowen
Copy link
Member Author

srowen commented Oct 23, 2016

I think we don't know exactly what the real exception is. The NPE occurs while handling the exception.

@srowen
Copy link
Member Author

srowen commented Oct 25, 2016

@maver1ck @gatorsmile are you OK with this change, at least? I feel like I'm missing the additional change you have in mind. I think the purpose here is just to avoid the NPE during exception handling.

@gatorsmile
Copy link
Member

@maver1ck Could you please try to run the fix? Thank you!

case e: SQLException =>
val cause = e.getNextException
if (e.getCause != cause) {
if (cause != null && e.getCause != cause) {
Copy link
Member

Choose a reason for hiding this comment

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

This looks correct as addSuppressed(null) will throw NPE. However, it might be hard to create a test for it...

@srowen
Copy link
Member Author

srowen commented Oct 26, 2016

Merged to master, and to 2.0 as a small clear fix. If there is a follow-on problem involving whatever exception this suppressed, I think that's separate.

asfgit pushed a commit that referenced this pull request Oct 26, 2016
…eption when saving DF to MySQL

## What changes were proposed in this pull request?

On null next exception in JDBC, don't init it as cause or suppressed

## How was this patch tested?

Existing tests

Author: Sean Owen <[email protected]>

Closes #15599 from srowen/SPARK-18022.

(cherry picked from commit 6c7d094)
Signed-off-by: Sean Owen <[email protected]>
ghost pushed a commit to dbtsai/spark that referenced this pull request Oct 26, 2016
…eption when saving DF to MySQL

## What changes were proposed in this pull request?

On null next exception in JDBC, don't init it as cause or suppressed

## How was this patch tested?

Existing tests

Author: Sean Owen <[email protected]>

Closes apache#15599 from srowen/SPARK-18022.
@srowen srowen closed this Oct 26, 2016
@srowen srowen deleted the SPARK-18022 branch October 26, 2016 12:21
robert3005 pushed a commit to palantir/spark that referenced this pull request Nov 1, 2016
…eption when saving DF to MySQL

## What changes were proposed in this pull request?

On null next exception in JDBC, don't init it as cause or suppressed

## How was this patch tested?

Existing tests

Author: Sean Owen <[email protected]>

Closes apache#15599 from srowen/SPARK-18022.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…eption when saving DF to MySQL

## What changes were proposed in this pull request?

On null next exception in JDBC, don't init it as cause or suppressed

## How was this patch tested?

Existing tests

Author: Sean Owen <[email protected]>

Closes apache#15599 from srowen/SPARK-18022.
@uzadude
Copy link
Contributor

uzadude commented Oct 31, 2018

@uzadude sir I am getting same error in spark-sql 2.3.1 version

I don't think you meant to approach me..

@gatorsmile
Copy link
Member

@shatestest Your problem is different from the issue this PR tries to resolve. If you can provide a test case to reproduce it, feel free to open a JIRA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants