-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-18164][SQL]ForeachSink should fail the Spark job if process throws exception
#15674
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
|
cc @tdas |
|
Test build #67715 has finished for PR 15674 at commit
|
| writer.close(e) | ||
| throw e | ||
| } | ||
| if (!isFailed) { |
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.
I think there is a better of write this now using try...catch...finally. Because the condition here will always be true
| writer.process(iter.next()) | ||
| } | ||
| } catch { | ||
| case e: Throwable => |
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.
wait.. isnt it simpler to do
try {
...
} catch {
case e =>
logError(.....)
throw e
} finally {
writer.close(e)
}
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.
cannot access e inside finally.
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.
oops. my bad.
|
LGTM pending tests. Should merge to master and 2.0 |
|
Test build #67730 has finished for PR 15674 at commit
|
|
Merging to master and 2.0. Thanks, @tdas |
… throws exception ## What changes were proposed in this pull request? Fixed the issue that ForeachSink didn't rethrow the exception. ## How was this patch tested? The fixed unit test. Author: Shixiong Zhu <[email protected]> Closes #15674 from zsxwing/foreach-sink-error. (cherry picked from commit 59cccbd) Signed-off-by: Shixiong Zhu <[email protected]>
… throws exception ## What changes were proposed in this pull request? Fixed the issue that ForeachSink didn't rethrow the exception. ## How was this patch tested? The fixed unit test. Author: Shixiong Zhu <[email protected]> Closes apache#15674 from zsxwing/foreach-sink-error.
… throws exception ## What changes were proposed in this pull request? Fixed the issue that ForeachSink didn't rethrow the exception. ## How was this patch tested? The fixed unit test. Author: Shixiong Zhu <[email protected]> Closes apache#15674 from zsxwing/foreach-sink-error.
What changes were proposed in this pull request?
Fixed the issue that ForeachSink didn't rethrow the exception.
How was this patch tested?
The fixed unit test.