hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Ding (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-1465) Filter inside foreach is broken
Date Fri, 16 Jul 2010 18:47:50 GMT

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

Richard Ding commented on PIG-1465:
-----------------------------------


I ran the script on trunk and wasn't able to reproduce (got the expected result). The only
change I made to the script was adding using clause to the load statement: 

{code}
a = load 'data.txt' using PigStorage(',') as (ind:chararray, f1:chararray, num:int, f2:chararray);
{code}



> Filter inside foreach is broken
> -------------------------------
>
>                 Key: PIG-1465
>                 URL: https://issues.apache.org/jira/browse/PIG-1465
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.7.0
>            Reporter: hc busy
>             Fix For: 0.8.0
>
>
> {quote}
> % cat data.txt
> x,a,1,a
> x,a,2,a
> x,a,3,b
> x,a,4,b
> y,a,1,a
> y,a,2,a
> y,a,3,b
> y,a,4,b
> % cat script.pig
> a = load 'data' as (ind:chararray, f1:chararray, num:int, f2:chararray);
> b = group a by ind;
> describe b;
> f = foreach b\{
>     all_total = SUM(a.num);
>     fed  = filter a by (f1==f2);
>     some_total = (int)SUM(fed.num);
>     generate group as ind, all_total, some_total;
> \}
> describe f;
> dump f;
> % pig -f script.pig
> (x,a,1,a,,)
> (x,a,2,a,,)
> (x,a,3,b,,)
> (x,a,4,b,,)
> (y,a,1,a,,)
> (y,a,2,a,,)
> (y,a,3,b,,)
> (y,a,4,b,,)
> % cat what_I_expected
> (x,10,3)
> (y,10,3)
> {quote}

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