hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Gates (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-1624) FOREACH AS documentation is incorrect
Date Fri, 17 Sep 2010 18:09:33 GMT

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

Alan Gates commented on PIG-1624:
---------------------------------

I should note as well that when a flatten is involved, the proper syntax is:

{code}
A = load '/Users/gates/test/data/studenttab10' as (name:chararray, b{}, gpa:double);
B = foreach A generate name, flatten(b) as (fred, bob, joe), gpa;
dump B;
{code}

Note the use of parenthesis to enclose the list of fields coming from the flattened bag.

> FOREACH AS documentation is incorrect
> -------------------------------------
>
>                 Key: PIG-1624
>                 URL: https://issues.apache.org/jira/browse/PIG-1624
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 0.7.0
>            Reporter: Alan Gates
>            Assignee: Corinne Chandel
>             Fix For: 0.9.0
>
>
> According to the Pig Latin manual (http://hadoop.apache.org/pig/docs/r0.7.0/piglatin_ref2.html#FOREACH)
the correct usage of AS in a FOREACH clause is:
> {code}
> B = foreach A generate $0, $1, $2 as (user, age, gpa);
> {code}
> However, this is incorrect, and produce a syntax error.  The correct syntax for AS for
FOREACH is:
> {code}
> B = foreach A generate $0 as user, $1 as age, $2 as gpa;
> {code}

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


Mime
View raw message