-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-18022][SQL] java.lang.NullPointerException instead of real exception when saving DF to MySQL #15599
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
Conversation
Test build #67381 has finished for PR 15599 at commit
|
If we do not have a test case, could you post the exception before the fix and the exception output after the fix? Thanks! |
I can try this fix on Monday. |
I think we don't know exactly what the real exception is. The NPE occurs while handling the exception. |
@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. |
@maver1ck Could you please try to run the fix? Thank you! |
@@ -607,7 +607,7 @@ object JdbcUtils extends Logging { | |||
} catch { | |||
case e: SQLException => | |||
val cause = e.getNextException | |||
if (e.getCause != cause) { | |||
if (cause != null && e.getCause != cause) { |
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.
This looks correct as addSuppressed(null)
will throw NPE. However, it might be hard to create a test for it...
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. |
…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 <sowen@cloudera.com> Closes #15599 from srowen/SPARK-18022. (cherry picked from commit 6c7d094) Signed-off-by: Sean Owen <sowen@cloudera.com>
…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 <sowen@cloudera.com> Closes apache#15599 from srowen/SPARK-18022.
…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 <sowen@cloudera.com> Closes apache#15599 from srowen/SPARK-18022.
…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 <sowen@cloudera.com> Closes apache#15599 from srowen/SPARK-18022.
@uzadude sir I am getting same error in spark-sql 2.3.1 version https://gist.github.com/shatestest/86ae9559c6114999e13a6eec3c80ec2b#file-driver-scala is there anything wrong am doing here ... |
I don't think you meant to approach me.. |
@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 |
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