pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1042505 - in /pig/trunk: CHANGES.txt src/org/apache/pig/newplan/logical/rules/PushDownForEachFlatten.java test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java
Date Mon, 06 Dec 2010 01:02:08 GMT
Author: daijy
Date: Mon Dec  6 01:02:08 2010
New Revision: 1042505

URL: http://svn.apache.org/viewvc?rev=1042505&view=rev
Log:
PIG-1751: New logical plan: PushDownForEachFlatten fail in UDF with unknown output schema

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

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1042505&r1=1042504&r2=1042505&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Dec  6 01:02:08 2010
@@ -225,6 +225,9 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1751: New logical plan: PushDownForEachFlatten fail in UDF with unknown
+output schema (daijy)
+
 PIG-1741: Lineage fail when flatten a bag (daijy)
 
 PIG-1739: zero status is returned when pig script fails (yanz)

Modified: pig/trunk/src/org/apache/pig/newplan/logical/rules/PushDownForEachFlatten.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/rules/PushDownForEachFlatten.java?rev=1042505&r1=1042504&r2=1042505&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/rules/PushDownForEachFlatten.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/rules/PushDownForEachFlatten.java Mon Dec
 6 01:02:08 2010
@@ -164,7 +164,7 @@ public class PushDownForEachFlatten exte
         } 
         
         private List<ProjectExpression> getProjectExpressions(LogicalExpressionPlan
expr) {
-            List<Operator> ops = expr.getSources();
+            List<Operator> ops = expr.getSinks();
             List<ProjectExpression> projs = new ArrayList<ProjectExpression>(
ops.size() );
             for( Operator op : ops ) {
                 if( op instanceof ProjectExpression ) {

Modified: pig/trunk/test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java?rev=1042505&r1=1042504&r2=1042505&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestNewPlanPushDownForeachFlatten.java Mon Dec  6 01:02:08
2010
@@ -1039,6 +1039,20 @@ public class TestNewPlanPushDownForeachF
         Assert.assertTrue(foreach.getSchema().getField(1).alias.equals("q1"));
         Assert.assertTrue(foreach.getSchema().getField(2).alias.equals("q2"));
     }
+    
+    // See PIG-1751
+    @Test
+    public void testForeachWithUserDefinedSchema2() throws Exception {
+        planTester.buildPlan("a = load '1.txt' as (a0:chararray);");
+        planTester.buildPlan("b = load '2.txt' as (b0:chararray);");
+        planTester.buildPlan("c = foreach b generate flatten(STRSPLIT(b0)) as c0;");
+        org.apache.pig.impl.logicalLayer.LogicalPlan  lp = planTester.buildPlan("d = join
c by (chararray)c0, a by a0;");
+        
+        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( lp );
+        
+        Operator op = newLogicalPlan.getSinks().get( 0 );
+        Assert.assertTrue(op instanceof LOJoin);
+    }
 
     public class MyPlanOptimizer extends LogicalPlanOptimizer {
         protected MyPlanOptimizer(OperatorPlan p,  int iterations) {



Mime
View raw message