pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1049325 - in /pig/trunk: CHANGES.txt src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java test/org/apache/pig/test/TestEvalPipeline2.java
Date Tue, 14 Dec 2010 23:21:14 GMT
Author: daijy
Date: Tue Dec 14 23:21:13 2010
New Revision: 1049325

URL: http://svn.apache.org/viewvc?rev=1049325&view=rev
Log:
PIG-1766: New logical plan: ImplicitSplitInserter should before DuplicateForEachColumnRewrite

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
    pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1049325&r1=1049324&r2=1049325&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Tue Dec 14 23:21:13 2010
@@ -236,6 +236,8 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1766: New logical plan: ImplicitSplitInserter should before DuplicateForEachColumnRewrite
(daijy)
+
 PIG-1762: Logical simplification fails on map key referenced values (yanz)
 
 PIG-1761: New logical plan: Exception when bag dereference in the middle of expression (daijy)

Modified: pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java?rev=1049325&r1=1049324&r2=1049325&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java Tue Dec
14 23:21:13 2010
@@ -57,23 +57,23 @@ public class LogicalPlanOptimizer extend
         List<Set<Rule>> ls = new ArrayList<Set<Rule>>();	    
 
         
-        // DuplicateForEachColumnRewrite set
-        // This insert Identity UDF in the case foreach duplicate field.
-        // This is because we need unique uid through out the plan
+        // ImplicitSplitInserter set
+        // This set of rules Insert Foreach dedicated for casting after load
         Set<Rule> s = new HashSet<Rule>();
-        Rule r = new DuplicateForEachColumnRewrite("DuplicateForEachColumnRewrite");
+        Rule r = new ImplicitSplitInserter("ImplicitSplitInserter");
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
-        // ImplicitSplitInserter set
-        // This set of rules Insert Foreach dedicated for casting after load
+
+        // DuplicateForEachColumnRewrite set
+        // This insert Identity UDF in the case foreach duplicate field.
+        // This is because we need unique uid through out the plan
         s = new HashSet<Rule>();
-        r = new ImplicitSplitInserter("ImplicitSplitInserter");
+        r = new DuplicateForEachColumnRewrite("DuplicateForEachColumnRewrite");
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-
+        
         // Logical expression simplifier
         s = new HashSet<Rule>();
         // add logical expression simplification rule

Modified: pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java?rev=1049325&r1=1049324&r2=1049325&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java Tue Dec 14 23:21:13 2010
@@ -942,7 +942,7 @@ public class TestEvalPipeline2 extends T
         assertFalse(iter.hasNext());
     }
     
-    // See PIG-1732
+    // See PIG-1745
     @Test
     public void testBinStorageByteCast() throws Exception{
         String[] input1 = {
@@ -983,4 +983,35 @@ public class TestEvalPipeline2 extends T
         assertTrue(t.size()==1);
         assertTrue(t.get(0).equals("APACHE"));
     }
+    
+    // See PIG-1766
+    @Test
+    public void testForEachSameOriginColumn() throws Exception{
+        String[] input1 = {
+                "1\t2",
+                "1\t3",
+                "2\t4",
+                "2\t5",
+        };
+        
+        String[] input2 = {
+                "1\tone",
+                "2\ttwo",
+        };
+        
+        Util.createInputFile(cluster, "table_testForEachSameOriginColumn1", input1);
+        Util.createInputFile(cluster, "table_testForEachSameOriginColumn2", input2);
+        pigServer.registerQuery("A = load 'table_testForEachSameOriginColumn1' AS (a0:int,
a1:int);");
+        pigServer.registerQuery("B = load 'table_testForEachSameOriginColumn2' AS (b0:int,
b1:chararray);");
+        pigServer.registerQuery("C = join A by a0, B by b0;");
+        pigServer.registerQuery("D = foreach B generate b0 as d0, b1 as d1;");
+        pigServer.registerQuery("E = join C by a1, D by d0;");
+        pigServer.registerQuery("F = foreach E generate b1, d1;");
+        
+        Iterator<Tuple> iter = pigServer.openIterator("F");
+        Tuple t = iter.next();
+        assertTrue(t.size()==2);
+        assertTrue(t.get(0).equals("one"));
+        assertTrue(t.get(1).equals("two"));
+    }
 }



Mime
View raw message