You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ol...@apache.org on 2008/09/25 00:37:16 UTC

svn commit: r698760 - in /incubator/pig/branches/types: CHANGES.txt src/org/apache/pig/impl/logicalLayer/LOForEach.java test/org/apache/pig/test/TestLogicalPlanBuilder.java

Author: olga
Date: Wed Sep 24 15:37:15 2008
New Revision: 698760

URL: http://svn.apache.org/viewvc?rev=698760&view=rev
Log:
PIG-455: "group" alias is lost after a flatten(group)


Modified:
    incubator/pig/branches/types/CHANGES.txt
    incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java
    incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java

Modified: incubator/pig/branches/types/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/CHANGES.txt?rev=698760&r1=698759&r2=698760&view=diff
==============================================================================
--- incubator/pig/branches/types/CHANGES.txt (original)
+++ incubator/pig/branches/types/CHANGES.txt Wed Sep 24 15:37:15 2008
@@ -245,3 +245,5 @@
     PIG-451: If an field is part of group followed by flatten, then referring
     to it causes a parse error (pradeepk via olgan)
 
+    PIG-455: "group" alias is lost after a flatten(group) (pradeepk vi olgan)
+

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java?rev=698760&r1=698759&r2=698760&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java Wed Sep 24 15:37:15 2008
@@ -234,7 +234,7 @@
                                     }
 								} else {
                                     if(!DataType.isSchemaType(planFs.type)) {
-								        newFs = new Schema.FieldSchema(null, planFs.type);
+								        newFs = new Schema.FieldSchema(planFs.alias, planFs.type);
                                     } else {
 								        newFs = new Schema.FieldSchema(null, DataType.BYTEARRAY);
                                     }

Modified: incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java?rev=698760&r1=698759&r2=698760&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java Wed Sep 24 15:37:15 2008
@@ -1534,6 +1534,17 @@
         buildPlan(query);
     }
     
+    @Test
+    public void testQuery105() {
+        // test that the alias "group" can be used
+        // after a flatten(group)
+        String query = "a = load 'st10k' as (name, age, gpa);" +
+"b = group a by name;" +
+"c = foreach b generate flatten(group), COUNT(a) as cnt;" +
+"d = foreach c generate group;";
+        buildPlan(query);
+    }
+    
     private Schema getSchemaFromString(String schemaString) throws ParseException {
         return getSchemaFromString(schemaString, DataType.BYTEARRAY);
     }