pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r904713 - in /hadoop/pig/trunk: CHANGES.txt src/org/apache/pig/impl/plan/OperatorPlan.java test/org/apache/pig/test/TestOperatorPlan.java
Date Sat, 30 Jan 2010 02:24:57 GMT
Author: daijy
Date: Sat Jan 30 02:24:57 2010
New Revision: 904713

URL: http://svn.apache.org/viewvc?rev=904713&view=rev
Log:
PIG-1212: LogicalPlan.replaceAndAddSucessors produce wrong result when successors are null

Modified:
    hadoop/pig/trunk/CHANGES.txt
    hadoop/pig/trunk/src/org/apache/pig/impl/plan/OperatorPlan.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestOperatorPlan.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=904713&r1=904712&r2=904713&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Sat Jan 30 02:24:57 2010
@@ -157,6 +157,8 @@
 PIG-1189: StoreFunc UDF should ship to the backend automatically without
 "register" (daijy)
 
+PIG-1212: LogicalPlan.replaceAndAddSucessors produce wrong result when successors are null
(daijy)
+
 Release 0.6.0 - Unreleased
 
 INCOMPATIBLE CHANGES

Modified: hadoop/pig/trunk/src/org/apache/pig/impl/plan/OperatorPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/plan/OperatorPlan.java?rev=904713&r1=904712&r2=904713&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/impl/plan/OperatorPlan.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/impl/plan/OperatorPlan.java Sat Jan 30 02:24:57 2010
@@ -864,7 +864,9 @@
            }
        }
        mFromEdges.removeKey(node);
-       mFromEdges.put(node,newSuccessors);
+       if (!newSuccessors.isEmpty()) {
+           mFromEdges.put(node,newSuccessors);
+       }
     }    
 
     // removes entry  for predecessor in list of predecessors of node, 
@@ -885,7 +887,9 @@
            }
        }
        mToEdges.removeKey(node);
-       mToEdges.put(node,newPredecessors);
+       if (!newPredecessors.isEmpty()) {
+           mToEdges.put(node,newPredecessors);
+       }
     }
     
     /**

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestOperatorPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestOperatorPlan.java?rev=904713&r1=904712&r2=904713&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestOperatorPlan.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestOperatorPlan.java Sat Jan 30 02:24:57 2010
@@ -17,6 +17,8 @@
  */
 package org.apache.pig.test;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -2948,5 +2950,38 @@
         
     }
 
+    // See PIG-1212
+    @Test
+    public void testPushBefore2() throws Exception {
+        TPlan plan = new TPlan();
+        TOperator[] ops = new TOperator[6];
+        
+        ops[0] = new SingleOperator("Load0");
+        ops[1] = new SingleOperator("Load1");
+        ops[2] = new SingleOperator("ForEach0");
+        ops[3] = new SingleOperator("ForEach1");
+        ops[4] = new MultiOperator("Join");
+        ops[5] = new SingleOperator("Filter");
+        
+        for (int i=0;i<6;i++)
+        	plan.add(ops[i]);
+        
+        plan.connect(ops[0], ops[2]);
+        plan.connect(ops[1], ops[3]);
+        plan.connect(ops[2], ops[4]);
+        plan.connect(ops[3], ops[4]);
+        plan.connect(ops[4], ops[5]);
+        
+        try {
+            plan.pushBefore(ops[4], ops[5], 0);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            PrintStream ps = new PrintStream(baos);
+            PlanPrinter<TOperator, TPlan> planPrinter = new PlanPrinter<TOperator,
TPlan>(ps, plan);
+            planPrinter.visit();
+            assertFalse(baos.toString().equals(""));
+        } catch (PlanException pe) {
+        }        
+    }
+
 }
 



Mime
View raw message