Author: daijy
Date: Thu Apr  1 22:36:14 2010
New Revision: 930117

URL: http://svn.apache.org/viewvc?rev=930117&view=rev
Log:
PIG-1335: UDFFinder should find LoadFunc used by POCast

Modified:
    hadoop/pig/trunk/CHANGES.txt
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/UDFFinder.java
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestMRCompiler.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=930117&r1=930116&r2=930117&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Thu Apr  1 22:36:14 2010
@@ -193,6 +193,8 @@ OPTIMIZATIONS
 
 BUG FIXES
 
+PIG-1335: UDFFinder should find LoadFunc used by POCast (daijy)
+
 PIG-1307: when we spill the DefaultDataBag we are not setting the sized 
changed flag to be true. (breed via daijy)
 
 PIG-1298: Restore file traversal behavior to Pig loaders (rding)

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/UDFFinder.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/UDFFinder.java?rev=930117&r1=930116&r2=930117&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/UDFFinder.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/plans/UDFFinder.java
 Thu Apr  1 22:36:14 2010
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
+import 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POCast;
 import 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserComparisonFunc;
 import 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc;
 import 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhyPlanVisitor;
@@ -91,5 +92,10 @@ public class UDFFinder extends PhyPlanVi
         UDFs.add(compFunc.getFuncSpec().toString());
     }
     
+    @Override
+    public void visitCast(POCast op) {
+        if (op.getFuncSpec()!=null)
+        UDFs.add(op.getFuncSpec().toString());
+    }
     
 }

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java?rev=930117&r1=930116&r2=930117&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
 Thu Apr  1 22:36:14 2010
@@ -1028,5 +1028,9 @@ public class POCast extends ExpressionOp
     public void setFieldSchema(ResourceFieldSchema s) {
         fieldSchema = s;
     }
+    
+    public FuncSpec getFuncSpec() {
+        return funcSpec;
+    }
 
 }

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestMRCompiler.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestMRCompiler.java?rev=930117&r1=930116&r2=930117&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestMRCompiler.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestMRCompiler.java Thu Apr  1 
22:36:14 2010
@@ -968,6 +968,24 @@ public class TestMRCompiler extends juni
         
     }
     
+    @Test
+    public void testCastFuncShipped() throws Exception{
+        
+        planTester.buildPlan("a = load '/tmp/input1' using " + 
PigStorageNoDefCtor.class.getName() + 
+                "('\t') as (a0, a1, a2);");
+        planTester.buildPlan("b = group a by a0;");
+        planTester.buildPlan("c = foreach b generate flatten(a);");
+        planTester.buildPlan("d = order c by a0;");
+        planTester.buildPlan("e = foreach d generate a1+a2;");
+        LogicalPlan lp = planTester.buildPlan("store e into '/tmp';");
+        planTester.typeCheckPlan(lp);
+        
+        PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
+        MROperPlan mp = Util.buildMRPlan(pp, pc);
+        MapReduceOper op = mp.getLeaves().get(0);
+        assertTrue(op.UDFs.contains(new 
FuncSpec(PigStorageNoDefCtor.class.getName())+"('\t')"));
+    }
+    
     private void run(PhysicalPlan pp, String expectedFile) throws Exception {
         String compiledPlan, goldenPlan = null;
         int MAX_SIZE = 100000;


Reply via email to