pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cheol...@apache.org
Subject svn commit: r1403805 - in /pig/trunk: CHANGES.txt src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java test/org/apache/pig/test/TestNewPlanColumnPrune.java
Date Tue, 30 Oct 2012 17:55:46 GMT
Author: cheolsoo
Date: Tue Oct 30 17:55:46 2012
New Revision: 1403805

URL: http://svn.apache.org/viewvc?rev=1403805&view=rev
Log:
PIG-2968 ColumnMapKeyPrune fails to prune a subtree inside foreach (knoguchi via cheolsoo)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java
    pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1403805&r1=1403804&r2=1403805&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Tue Oct 30 17:55:46 2012
@@ -334,6 +334,8 @@ OPTIMIZATIONS
 
 BUG FIXES
 
+PIG-2968: ColumnMapKeyPrune fails to prune a subtree inside foreach (knoguchi via cheolsoo)
+
 PIG-2999: Regression after PIG-2975: BinInterSedesTupleRawComparator secondary sort failing
(knoguchi via azaroth)
 
 PIG-2998: Fix TestScriptLanguage and TestMacroExpansion (cheolsoo via jcoveney)

Modified: pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java?rev=1403805&r1=1403804&r2=1403805&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java Tue Oct 30
17:55:46 2012
@@ -448,7 +448,7 @@ public class ColumnPruneVisitor extends 
         LogicalPlan p = (LogicalPlan)op.getPlan();
         List<Operator> ll = p.getPredecessors(op);
         if (ll != null) {
-            for(Operator pred: ll) {
+            for(Operator pred: ll.toArray(new Operator[ll.size()])) {
                 removeSubTree((LogicalRelationalOperator)pred);
             }
         }

Modified: pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java?rev=1403805&r1=1403804&r2=1403805&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java Tue Oct 30 17:55:46 2012
@@ -390,7 +390,26 @@ public class TestNewPlanColumnPrune exte
         
         assertTrue(expected.isEqual(newLogicalPlan));
     }
-    
+
+    public void testPruneSubTreeForEach() throws Exception  {
+        String query = "a =load 'd.txt' as (id, v1);" +
+            "b = group a by id;" +
+            "c = foreach b { d = a.v1; " +
+                          " e = distinct d; " +
+                          " generate group, e; };" +
+            "f = foreach c generate group ;" +
+            "store f into 'empty';";
+        LogicalPlan newLogicalPlan = buildPlan(query);
+        PlanOptimizer optimizer = new MyPlanOptimizer(newLogicalPlan, 3);
+        try {
+            optimizer.optimize();
+        } catch (Exception e) {
+            //PIG-2968 throws ConcurrentModificationException
+            e.printStackTrace();
+            fail("Unexpected Exception: " + e);
+        }
+    }
+
     public class MyPlanOptimizer extends LogicalPlanOptimizer {
 
         protected MyPlanOptimizer(OperatorPlan p,  int iterations) {



Mime
View raw message