You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by kn...@apache.org on 2014/10/01 20:04:33 UTC
svn commit: r1628794 - in /pig/branches/branch-0.14: CHANGES.txt
src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java
test/org/apache/pig/test/TestLimitVariable.java
Author: knoguchi
Date: Wed Oct 1 18:04:33 2014
New Revision: 1628794
URL: http://svn.apache.org/r1628794
Log:
PIG-4212: Allow LIMIT of 0 for variableLimit (constant 0 is already allowed) (knoguchi)
Modified:
pig/branches/branch-0.14/CHANGES.txt
pig/branches/branch-0.14/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java
pig/branches/branch-0.14/test/org/apache/pig/test/TestLimitVariable.java
Modified: pig/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/CHANGES.txt?rev=1628794&r1=1628793&r2=1628794&view=diff
==============================================================================
--- pig/branches/branch-0.14/CHANGES.txt (original)
+++ pig/branches/branch-0.14/CHANGES.txt Wed Oct 1 18:04:33 2014
@@ -84,6 +84,8 @@ OPTIMIZATIONS
BUG FIXES
+PIG-4212: Allow LIMIT of 0 for variableLimit (constant 0 is already allowed) (knoguchi)
+
PIG-4196: Auto ship udf jar is broken (daijy)
PIG-4214: Fix unit test fail TestMRJobStats (daijy)
Modified: pig/branches/branch-0.14/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java?rev=1628794&r1=1628793&r2=1628794&view=diff
==============================================================================
--- pig/branches/branch-0.14/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java (original)
+++ pig/branches/branch-0.14/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLimit.java Wed Oct 1 18:04:33 2014
@@ -108,8 +108,8 @@ public class POLimit extends PhysicalOpe
default:
throw new RuntimeException("Limit requires an integer parameter");
}
- if (variableLimit <= 0)
- throw new RuntimeException("Limit requires a positive integer parameter");
+ if (variableLimit < 0)
+ throw new RuntimeException("Limit requires a zero or a positive integer parameter");
this.setLimit(variableLimit);
}
Result inp = null;
Modified: pig/branches/branch-0.14/test/org/apache/pig/test/TestLimitVariable.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/test/org/apache/pig/test/TestLimitVariable.java?rev=1628794&r1=1628793&r2=1628794&view=diff
==============================================================================
--- pig/branches/branch-0.14/test/org/apache/pig/test/TestLimitVariable.java (original)
+++ pig/branches/branch-0.14/test/org/apache/pig/test/TestLimitVariable.java Wed Oct 1 18:04:33 2014
@@ -20,6 +20,7 @@ package org.apache.pig.test;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -209,4 +210,20 @@ public class TestLimitVariable {
"(1,11)", "(2,3)", "(3,10)", "(6,15)" });
Util.checkQueryOutputsAfterSort(it, expectedRes);
}
+
+ @Test
+ public void testZeroLimitVariable() throws Throwable {
+ String query =
+ "a = load '" + inputFile.getName() + "';" +
+ "b = group a all;" +
+ "c = foreach b generate COUNT(a) as sum;" +
+ "d = limit a c.sum - c.sum; "
+ ;
+
+ Util.registerMultiLineQuery(pigServer, query);
+ Iterator<Tuple> it = pigServer.openIterator("d");
+
+ List<Tuple> emptyresult = new ArrayList<Tuple>(0);
+ Util.checkQueryOutputsAfterSort(it, emptyresult);
+ }
}