aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorTejas Patil <tejasp@fb.com>2016-07-06 09:18:04 +0100
committerSean Owen <sowen@cloudera.com>2016-07-06 09:18:04 +0100
commit5f342049cce9102fb62b4de2d8d8fa691c2e8ac4 (patch)
treebc75079b6d502c4424f8edb7696c038e6a5e5bc3 /sql/hive
parentec79183ac5b842e49baa40ea1c9a72ce8f108fe5 (diff)
downloadspark-5f342049cce9102fb62b4de2d8d8fa691c2e8ac4.tar.gz
spark-5f342049cce9102fb62b4de2d8d8fa691c2e8ac4.tar.bz2
spark-5f342049cce9102fb62b4de2d8d8fa691c2e8ac4.zip
[SPARK-16339][CORE] ScriptTransform does not print stderr when outstream is lost
## What changes were proposed in this pull request? Currently, if due to some failure, the outstream gets destroyed or closed and later `outstream.close()` leads to IOException in such case. Due to this, the `stderrBuffer` does not get logged and there is no way for users to see why the job failed. The change is to first display the stderr buffer and then try closing the outstream. ## How was this patch tested? The correct way to test this fix would be to grep the log to see if the `stderrBuffer` gets logged but I dont think having test cases which do that is a good idea. (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) … Author: Tejas Patil <tejasp@fb.com> Closes #13834 from tejasapatil/script_transform.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/ScriptTransformation.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/ScriptTransformation.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/ScriptTransformation.scala
index 84990d3697..d063dd6b7f 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/ScriptTransformation.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/ScriptTransformation.scala
@@ -314,15 +314,15 @@ private class ScriptTransformationWriterThread(
}
threwException = false
} catch {
- case NonFatal(e) =>
+ case t: Throwable =>
// An error occurred while writing input, so kill the child process. According to the
// Javadoc this call will not throw an exception:
- _exception = e
+ _exception = t
proc.destroy()
- throw e
+ throw t
} finally {
try {
- outputStream.close()
+ Utils.tryLogNonFatalError(outputStream.close())
if (proc.waitFor() != 0) {
logError(stderrBuffer.toString) // log the stderr circular buffer
}