You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Pradeep Kamath (JIRA)" <ji...@apache.org> on 2009/12/01 19:40:20 UTC

[jira] Commented: (PIG-1112) FLATTEN eliminates the alias

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

Pradeep Kamath commented on PIG-1112:
-------------------------------------

Pig doesn't handle partial schemas well - the fix for this issue will depend on how we want to treat unknown schemas. I did verify that this works when the schema specified is complete:

{code}
A = LOAD 'sample' using PigStorage() as (first:chararray, second:chararray, ladder:bag{t:tuple(x:int)});
B = FOREACH A GENERATE first,FLATTEN(ladder) as third,second;
C = GROUP B by (first,third);
describe C;
{code}

Here's the output:
C: {group: (first: chararray,third: int),B: {first: chararray,third: int,second: chararray}}

> FLATTEN eliminates the alias
> ----------------------------
>
>                 Key: PIG-1112
>                 URL: https://issues.apache.org/jira/browse/PIG-1112
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Ankur
>            Assignee: Daniel Dai
>             Fix For: 0.6.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.