Author: namit Date: Thu Feb 28 10:48:31 2013 New Revision: 1451171 URL: http://svn.apache.org/r1451171 Log: HIVE-4090 Use of hive.exec.script.allow.partial.consumption can produce partial results (Kevin Wilfong via namit)
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java?rev=1451171&r1=1451170&r2=1451171&view=diff ============================================================================== --- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java (original) +++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java Thu Feb 28 10:48:31 2013 @@ -372,6 +372,21 @@ public class ScriptOperator extends Oper throw new HiveException(e); } catch (IOException e) { if (isBrokenPipeException(e) && allowPartialConsumption()) { + // Give the outThread a chance to finish before marking the operator as done + try { + scriptPid.waitFor(); + } catch (InterruptedException interruptedException) { + } + // best effort attempt to write all output from the script before marking the operator + // as done + try { + if (outThread != null) { + outThread.join(0); + } + } catch (Exception e2) { + LOG.warn("Exception in closing outThread: " + + StringUtils.stringifyException(e2)); + } setDone(true); LOG .warn("Got broken pipe during write: ignoring exception and setting operator to done");