When a single column is flattened, the alias is lost in subsequent statements 
that refer to the alias
-----------------------------------------------------------------------------------------------------

                 Key: PIG-436
                 URL: https://issues.apache.org/jira/browse/PIG-436
             Project: Pig
          Issue Type: Bug
    Affects Versions: types_branch
            Reporter: Santhosh Srinivasan
            Assignee: Pradeep Kamath
             Fix For: types_branch


When a single column is flattened, the front end generates aliases that 
disambiguate the columns in the flattened column. Subsequent statements that 
refer to this column always need to refer to the unambiguous alias even though 
there could be no ambiguity. A reproducible use case is given below:

{code}
a = load 'one' as (name, age, gpa);
b = group a by name;
c = foreach b generate flatten(a);
d = foreach c generate name;
e = foreach d generate name;

1971337 [main] ERROR org.apache.pig.tools.grunt.GruntParser  - 
java.io.IOException: Invalid alias: name in {a::name: bytearray}
        at org.apache.pig.PigServer.parseQuery(PigServer.java:293)
        at org.apache.pig.PigServer.registerQuery(PigServer.java:258)
        at 
org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:432)
        at 
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:242)
        at 
org.apache.pig.tools.grunt.GruntParser.parseContOnError(GruntParser.java:93)
        at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:58)
        at org.apache.pig.Main.main(Main.java:282)
Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException: Invalid 
alias: name in {a::name: bytearray}
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.AliasFieldOrSpec(QueryParser.java:5818)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.ColOrSpec(QueryParser.java:5677)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseEvalSpec(QueryParser.java:3969)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.UnaryExpr(QueryParser.java:3866)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.CastExpr(QueryParser.java:3820)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.MultiplicativeExpr(QueryParser.java:3729)
        at 
org.apache.pig.impl.logicalLayer.parser.QueryParser.AdditiveExpr(QueryParser.java:3653)
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to