PIG-5198: streaming job stuck with script failure when combined with split (knoguchi)


git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1789157 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index e24302b..1b51212 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -91,6 +91,8 @@
  
 BUG FIXES
 
+PIG-5198: streaming job stuck with script failure when combined with split (knoguchi)
+
 PIG-5183: We shall mention NATIVE instead of MAPREDUCE operator in document (daijy)
 
 PIG-5182: ant docs target is broken by PIG-5110 (daijy)
diff --git a/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSplit.java b/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSplit.java
index 2fc771d..8ca294f 100644
--- a/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSplit.java
+++ b/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSplit.java
@@ -241,7 +241,8 @@
             }
         }
 
-        return (res.returnStatus == POStatus.STATUS_OK) ? res : RESULT_EMPTY;
+        return (res.returnStatus == POStatus.STATUS_OK ||
+                res.returnStatus == POStatus.STATUS_ERR ) ? res : RESULT_EMPTY;
     }
 
     private Result runPipeline(PhysicalOperator leaf) throws ExecException {
diff --git a/test/e2e/pig/tests/negative.conf b/test/e2e/pig/tests/negative.conf
index 9a92528..7b65e13 100644
--- a/test/e2e/pig/tests/negative.conf
+++ b/test/e2e/pig/tests/negative.conf
@@ -457,6 +457,20 @@
 store B into ':OUTPATH:';\,
                         'expected_err_regex' => "failed with exit status: 2",
                         },
+			{
+                        'num' => 5,
+			'execonly' => 'mapred,tez',
+                        'pig' => q\
+define BADCMD `perl PigStreamingBad.pl start` ship(':SCRIPTHOMEPATH:/PigStreamingBad.pl');
+define GOODCMD `perl PigStreaming.pl` ship(':SCRIPTHOMEPATH:/PigStreaming.pl') ;
+A = load ':INPATH:/singlefile/studenttab10k';
+B = stream A through GOODCMD;
+C = stream A through BADCMD;
+store B into ':OUTPATH:.1';
+store C into ':OUTPATH:.2';\,
+                        'expected_err_regex' => "failed with exit status: 1|Error while reading from POStream and passing it to the streaming",
+                        },
+
                 ]
 		},
 		{