[ 
https://issues.apache.org/jira/browse/PIG-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12928889#action_12928889
 ] 

Alan Gates commented on PIG-1112:
---------------------------------

Daniel, I don't understand the choice here.  I think we agreed that if the user 
specifies (third, second) as the schema then we take that to mean there are two 
bytearray fields and we project them to guarantee this.  So

{code}
B = FOREACH A GENERATE first,FLATTEN(ladder) as third,second;
{code}

will now be equivalent to
{code}
Bprime = FOREACH A GENERATE first,FLATTEN(ladder);
B = FOREACH Bprime GENERATE first, $1 as third, $2 as second;
{code}

> FLATTEN eliminates the alias
> ----------------------------
>
>                 Key: PIG-1112
>                 URL: https://issues.apache.org/jira/browse/PIG-1112
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Ankur
>            Assignee: Alan Gates
>             Fix For: 0.9.0
>
>
> If schema for a field of type 'bag' is partially defined then FLATTEN() 
> incorrectly eliminates the field and throws an error. 
> Consider the following example:-
> A = LOAD 'sample' using PigStorage() as (first:chararray, second:chararray, 
> ladder:bag{});              
> B = FOREACH A GENERATE first,FLATTEN(ladder) as third,second;                 
>                   
> C = GROUP B by (first,third);
> This throws the error
>  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. 
> Invalid alias: third in {first: chararray,second: chararray}

-- 
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