hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1381597 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ScriptOperator.java
Date Thu, 06 Sep 2012 13:41:32 GMT
Author: hashutosh
Date: Thu Sep  6 13:41:32 2012
New Revision: 1381597

URL: http://svn.apache.org/viewvc?rev=1381597&view=rev
Log:
HIVE-3436 :  Difference in exception string from native method causes script_pipe.q to fail
on windows (Thejas Nair via Ashutosh Chauhan)

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=1381597&r1=1381596&r2=1381597&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 Sep  6 13:41:32
2012
@@ -46,6 +46,7 @@ import org.apache.hadoop.io.BytesWritabl
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.util.StringUtils;
 
 /**
@@ -80,6 +81,8 @@ public class ScriptOperator extends Oper
   transient RecordWriter scriptOutWriter = null;
 
   static final String IO_EXCEPTION_BROKEN_PIPE_STRING = "Broken pipe";
+  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";
 
   /**
    * sends periodic reports back to the tracker.
@@ -245,7 +248,12 @@ public class ScriptOperator extends Oper
   }
 
   boolean isBrokenPipeException(IOException e) {
-    return (e.getMessage().compareToIgnoreCase(IO_EXCEPTION_BROKEN_PIPE_STRING) == 0);
+  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_BROKEN_PIPE_STRING));
   }
 
   boolean allowPartialConsumption() {



Mime
View raw message