hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hc busy (JIRA)" <j...@apache.org>
Subject [jira] Updated: (PIG-1465) Filter inside foreach is broken
Date Fri, 25 Jun 2010 18:34:52 GMT

     [ https://issues.apache.org/jira/browse/PIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

hc busy updated PIG-1465:
-------------------------

    Description: 
{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}

  was:
{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}



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