Author: gates
Date: Thu Dec  6 11:10:18 2007
New Revision: 601820

URL: http://svn.apache.org/viewvc?rev=601820&view=rev
Log:
PIG-43: fixed problem where using the combiner prevented a pig alias
from being evaluated more than once.


Modified:
    incubator/pig/trunk/CHANGES.txt
    
incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/MapreducePlanCompiler.java

Modified: incubator/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=601820&r1=601819&r2=601820&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Thu Dec  6 11:10:18 2007
@@ -37,3 +37,6 @@
        PIG-7: Added use of combiner in some restricted cases. (gates)
        
        PIG-29: fixed bag factory to be properly initialized (utkarsh)
+
+    PIG-43: fixed problem where using the combiner prevented a pig alias
+    from being evaluated more than once. (gates)

Modified: 
incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/MapreducePlanCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/MapreducePlanCompiler.java?rev=601820&r1=601819&r2=601820&view=diff
==============================================================================
--- 
incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/MapreducePlanCompiler.java
 (original)
+++ 
incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/MapreducePlanCompiler.java
 Thu Dec  6 11:10:18 2007
@@ -214,7 +214,7 @@
                 if (mro.toCombine != null) {
                     throw new AssertionError("Combiner already set.");
                 }
-                mro.toCombine = spec;
+                // mro.toCombine = spec;
 
                 // Now, we need to adjust the expected projection for the
                 // eval spec(s) we just pushed.  Also, this will change the
@@ -225,9 +225,13 @@
 
                 // Adjust the function name for the combine spec, to set it
                 // to the initial function instead of the general
-                // instance.  This has to be done after the copy is made
-                // for the combiner.
-                spec.visit(new CombineAdjuster());
+                // instance.  Make a copy of the eval spec rather than
+                // adjusting the existing one, to prevent breaking the 
+                // logical plan in case another physical plan is generated
+                // from it later.
+                EvalSpec combineSpec = spec.copy(pigContext);
+                combineSpec.visit(new CombineAdjuster());
+                mro.toCombine = combineSpec;
 
             } else {
                 mro.addReduceSpec(lo.getSpec()); // otherwise, don't use 
combiner


Reply via email to