From e22fcb2967489388f07307e3de689a7c9cc9b6f8 Mon Sep 17 00:00:00 2001 From: Koji Noguchi Date: Tue, 25 Aug 2020 19:40:51 +0000 Subject: [PATCH] PIG-5403: streaming job stuck with script failure when combined with ORDER BY (knoguchi) git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1881193 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../relationalOperators/POReservoirSample.java | 8 ++++++-- test/e2e/pig/tests/negative.conf | 13 ++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index e55dcf2dd4..83351561f3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -100,6 +100,8 @@ OPTIMIZATIONS BUG FIXES +PIG-5403: streaming job stuck with script failure when combined with ORDER BY (knoguchi) + PIG-5362: Parameter substitution of shell cmd results doesn't handle backslash addendum (szita) PIG-5395: Pig build is failing due to maven repo access point change (szita) diff --git a/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POReservoirSample.java b/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POReservoirSample.java index dc4c188784..437849a384 100644 --- a/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POReservoirSample.java +++ b/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POReservoirSample.java @@ -103,7 +103,9 @@ public Result getNextTuple() throws ExecException { Result res = null; while (rowProcessed < numSamples) { res = processInput(); - if (res.returnStatus == POStatus.STATUS_OK) { + if (res.returnStatus == POStatus.STATUS_ERR) { + return res; + } else if (res.returnStatus == POStatus.STATUS_OK) { samples[(int)rowProcessed] = res; rowProcessed++; } else if (res.returnStatus == POStatus.STATUS_NULL) { @@ -125,7 +127,9 @@ public Result getNextTuple() throws ExecException { while (true) { // pick this as sample res = processInput(); - if (res.returnStatus == POStatus.STATUS_NULL) { + if (res.returnStatus == POStatus.STATUS_ERR) { + return res; + } else if (res.returnStatus == POStatus.STATUS_NULL) { continue; } else if (res.returnStatus != POStatus.STATUS_OK) { break; diff --git a/test/e2e/pig/tests/negative.conf b/test/e2e/pig/tests/negative.conf index d09a661005..c159d1b5a7 100644 --- a/test/e2e/pig/tests/negative.conf +++ b/test/e2e/pig/tests/negative.conf @@ -457,7 +457,7 @@ B = stream A through CMD; store B into ':OUTPATH:';\, 'expected_err_regex' => "failed with exit status: 2", }, - { + { 'num' => 5, 'execonly' => 'mapred,tez', 'pig' => q\ @@ -469,6 +469,17 @@ 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", + }, + { + 'num' => 6, + 'execonly' => 'mapred,tez', + 'pig' => q\ +define BADCMD `perl PigStreamingBad.pl middle` ship(':SCRIPTHOMEPATH:/PigStreamingBad.pl'); +A = load ':INPATH:/singlefile/studenttab10k'; +B = stream A through BADCMD; +C = ORDER B by *; +store C into ':OUTPATH:.1';\, + 'expected_err_regex' => "failed with exit status: 2|Error while reading from POStream and passing it to the streaming", }, ]