Author: daijy
Date: Tue Jul 27 16:50:16 2010
New Revision: 979771

URL: http://svn.apache.org/viewvc?rev=979771&view=rev
Log:
PIG-1445: Pig error: ERROR 2013: Moving LOLimit in front of LOStream is not 
implemented

Modified:
    hadoop/pig/trunk/CHANGES.txt
    
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/OpLimitOptimizer.java
    hadoop/pig/trunk/test/org/apache/pig/test/OpLimitOptimizerPrinter.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestLogicalOptimizer.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=979771&r1=979770&r2=979771&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Tue Jul 27 16:50:16 2010
@@ -106,6 +106,8 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1445: Pig error: ERROR 2013: Moving LOLimit in front of LOStream is not 
implemented (daijy)
+
 PIG-348:  -j command line option doesn't work (rding)
 
 PIG-1487: Replace "bz" with ".bz" in all the LoadFunc

Modified: 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/OpLimitOptimizer.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/OpLimitOptimizer.java?rev=979771&r1=979770&r2=979771&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/OpLimitOptimizer.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/optimizer/OpLimitOptimizer.java
 Tue Jul 27 16:50:16 2010
@@ -35,6 +35,7 @@ import org.apache.pig.impl.logicalLayer.
 import org.apache.pig.impl.logicalLayer.LOSort;
 import org.apache.pig.impl.logicalLayer.LOSplit;
 import org.apache.pig.impl.logicalLayer.LOSplitOutput;
+import org.apache.pig.impl.logicalLayer.LOStream;
 import org.apache.pig.impl.logicalLayer.LOUnion;
 import org.apache.pig.impl.logicalLayer.LOJoin;
 import org.apache.pig.impl.logicalLayer.LOJoin;
@@ -98,7 +99,7 @@ public class OpLimitOptimizer extends Lo
             // Limit cannot be pushed up
             if (predecessor instanceof LOCogroup || predecessor instanceof 
LOFilter ||
                     predecessor instanceof LOLoad || predecessor instanceof 
LOSplit ||
-                    predecessor instanceof LODistinct || predecessor 
instanceof LOJoin)
+                    predecessor instanceof LODistinct || predecessor 
instanceof LOJoin || predecessor instanceof LOStream)
             {
                 return false;
             }

Modified: hadoop/pig/trunk/test/org/apache/pig/test/OpLimitOptimizerPrinter.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/OpLimitOptimizerPrinter.java?rev=979771&r1=979770&r2=979771&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/OpLimitOptimizerPrinter.java 
(original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/OpLimitOptimizerPrinter.java Tue 
Jul 27 16:50:16 2010
@@ -142,6 +142,9 @@ public class OpLimitOptimizerPrinter ext
         appendEdges(op);
     }
 
+    protected void visit(LOStream op) {
+        appendEdges(op);
+    }
 
     private void appendOp(LogicalOperator op)  {
         sb.append("    
"+op.getClass().getSimpleName()+op.getOperatorKey().getId()) ;

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestLogicalOptimizer.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestLogicalOptimizer.java?rev=979771&r1=979770&r2=979771&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestLogicalOptimizer.java 
(original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestLogicalOptimizer.java Tue Jul 
27 16:50:16 2010
@@ -269,6 +269,16 @@ public class TestLogicalOptimizer extend
         LogicalPlan plan = planTester.buildPlan("B = foreach (limit (order 
(load 'myfile' AS (a0, a1, a2)) by $1) 10) generate $0;");
         optimizePlan(plan);
     }
+    
+    @Test
+    //See bug PIG-1445
+    public void testOPLimit12Optimizer() throws Exception {
+        planTester.buildPlan("A = load 'myfile';");
+        planTester.buildPlan("B = STREAM A THROUGH `stream.pl`;");
+        LogicalPlan plan = planTester.buildPlan("C = LIMIT B 10;");
+        optimizePlan(plan);
+        compareWithGoldenFile(plan, FILE_BASE_LOCATION + "optlimitplan12.dot");
+    }
 
     /**
      * test to check that {...@link LoadMetadata#getSchema(String, Job)} is 
called


Reply via email to