You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2011/02/23 00:41:42 UTC

svn commit: r1073552 - in /pig/branches/branch-0.8: CHANGES.txt src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt test/org/apache/pig/test/TestEvalPipeline2.java

Author: daijy
Date: Tue Feb 22 23:41:41 2011
New Revision: 1073552

URL: http://svn.apache.org/viewvc?rev=1073552&view=rev
Log:
PIG-1858: UDF in nested plan results frontend exception

Modified:
    pig/branches/branch-0.8/CHANGES.txt
    pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
    pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java

Modified: pig/branches/branch-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/CHANGES.txt?rev=1073552&r1=1073551&r2=1073552&view=diff
==============================================================================
--- pig/branches/branch-0.8/CHANGES.txt (original)
+++ pig/branches/branch-0.8/CHANGES.txt Tue Feb 22 23:41:41 2011
@@ -213,6 +213,8 @@ PIG-1309: Map-side Cogroup (ashutoshc)
 
 BUG FIXES
 
+PIG-1858: UDF in nested plan results frontend exception (daijy)
+
 PIG-1862: Pig returns exit code 0 for the failed Pig script due to non-existing input directory (rding)
 
 PIG-1850: Order by is failing with ClassCastException if schema is undefined

Modified: pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt?rev=1073552&r1=1073551&r2=1073552&view=diff
==============================================================================
--- pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt (original)
+++ pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt Tue Feb 22 23:41:41 2011
@@ -2320,7 +2320,7 @@ LogicalOperator UnionClause(LogicalPlan 
             MultiMap<LogicalOperator, LogicalOperator> mapProjectInputs = null;
             Map<LogicalOperator, Boolean> rootProcessed = new HashMap<LogicalOperator, Boolean>();
             for(LogicalOperator root: planRoots) {
-                if(root instanceof ExpressionOperator && !(root instanceof LOProject)) {
+                if(root instanceof ExpressionOperator) {
                     if(checkGenerateInput(root)) {
                         needGenerateInput = true;
                         attachPlan(generatePlan, root, foreachPlan, rootProcessed);

Modified: pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java?rev=1073552&r1=1073551&r2=1073552&view=diff
==============================================================================
--- pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java (original)
+++ pig/branches/branch-0.8/test/org/apache/pig/test/TestEvalPipeline2.java Tue Feb 22 23:41:41 2011
@@ -1205,4 +1205,26 @@ public class TestEvalPipeline2 extends T
         assertTrue(t.toString().contains("(0.0,1)"));
         assertFalse(iter.hasNext());
     }
+    
+    // See PIG-1858
+    @Test
+    public void testNestedUDFofBag() throws Exception{
+        String[] input = {
+                "0\t1",
+                "0\t1",
+                "0\t2"
+        };
+        
+        Util.createInputFile(cluster, "table_testNestedUDFofBag", input);
+
+        pigServer.registerQuery("a = load 'table_testNestedUDFofBag' as (a0:int,a1:int);");
+        pigServer.registerQuery("b = group a by a0;");
+        pigServer.registerQuery("c = foreach b { c1 = order a by a1; c2 = org.apache.pig.builtin.Distinct(c1.$1).($0,$1);generate c2.$0;};");
+        
+        Iterator<Tuple> iter = pigServer.openIterator("c");
+        
+        Tuple t = iter.next();
+        assertTrue(t.toString().equals("({(1),(2)})"));
+        assertFalse(iter.hasNext());
+    }
 }