Index: ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java (revision 1409223) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java (working copy) @@ -81,6 +81,8 @@ transient RecordWriter scriptOutWriter = null; static final String IO_EXCEPTION_BROKEN_PIPE_STRING = "Broken pipe"; + // added for IBM JDK + static final String IO_EXCEPTION_NO_FILE_STRING ="No such file or directory"; static final String IO_EXCEPTION_PIPE_ENDED_WIN = "The pipe has been ended"; static final String IO_EXCEPTION_PIPE_CLOSED_WIN = "The pipe is being closed"; @@ -255,6 +257,15 @@ } return (e.getMessage().equalsIgnoreCase(IO_EXCEPTION_BROKEN_PIPE_STRING)); } + + boolean isNoFileException(IOException e) { + if (Shell.WINDOWS) { + String errMsg = e.getMessage(); + return errMsg.equalsIgnoreCase(IO_EXCEPTION_PIPE_CLOSED_WIN) || + errMsg.equalsIgnoreCase(IO_EXCEPTION_PIPE_ENDED_WIN); + } + return (e.getMessage().equalsIgnoreCase(IO_EXCEPTION_NO_FILE_STRING)); + } boolean allowPartialConsumption() { return HiveConf.getBoolVar(hconf, HiveConf.ConfVars.ALLOWPARTIALCONSUMP); @@ -369,13 +380,14 @@ serialize_error_count.set(serialize_error_count.get() + 1); throw new HiveException(e); } catch (IOException e) { - if (isBrokenPipeException(e) && allowPartialConsumption()) { + // won't throw an exception if the process doesn't complete + if ((isBrokenPipeException(e) || isNoFileException(e)) && allowPartialConsumption()) { setDone(true); LOG .warn("Got broken pipe during write: ignoring exception and setting operator to done"); } else { LOG.error("Error in writing to script: " + e.getMessage()); - if (isBrokenPipeException(e)) { + if (isBrokenPipeException(e) || isNoFileException(e)) { displayBrokenPipeInfo(); } scriptError = e; @@ -399,10 +411,11 @@ scriptOutWriter.close(); } } catch (IOException e) { - if (isBrokenPipeException(e) && allowPartialConsumption()) { + // won't throw an exception if the process doesn't complete + if ((isBrokenPipeException(e) || isNoFileException(e)) && allowPartialConsumption()) { LOG.warn("Got broken pipe: ignoring exception"); } else { - if (isBrokenPipeException(e)) { + if (isBrokenPipeException(e) || isNoFileException(e)) { displayBrokenPipeInfo(); } throw e;