You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by prasenjit mukherjee <pr...@gmail.com> on 2009/09/15 00:28:33 UTC
filter by arity in group
I would like to filter a set of rows ( of groups ) based on its arity
of a specified field . Can I do this in my pig script :
r1 = LOAD ...... AS f1,f2,f3;
gr1 = GROUP r1 BY (f1,f2);
gr1 = FILTER gr1 BY ARITY(r1) > 1;
I didnt find any documentation on ARITY.
-Prasenjit
Re: filter by arity in group
Posted by prasenjit mukherjee <pr...@gmail.com>.
apparantly that didnt work, worked after I replaced arity with SIZE().
On Mon, Sep 14, 2009 at 11:38 PM, Nikhil Gupta <gu...@gmail.com> wrote:
> That should work. ARITY is a pretty straightforward UDF, check out the
> source -
> http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/ARITY.java?view=markup
>
> <http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/ARITY.java?view=markup>
> hth
> -nikhil
> http://stanford.edu/~nikgupta
>
> On Tue, Sep 15, 2009 at 3:58 AM, prasenjit mukherjee
> <pr...@gmail.com>wrote:
>
>> I would like to filter a set of rows ( of groups ) based on its arity
>> of a specified field . Can I do this in my pig script :
>>
>> r1 = LOAD ...... AS f1,f2,f3;
>> gr1 = GROUP r1 BY (f1,f2);
>> gr1 = FILTER gr1 BY ARITY(r1) > 1;
>>
>> I didnt find any documentation on ARITY.
>>
>> -Prasenjit
>>
>
Re: filter by arity in group
Posted by Nikhil Gupta <gu...@gmail.com>.
That should work. ARITY is a pretty straightforward UDF, check out the
source -
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/ARITY.java?view=markup
<http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/ARITY.java?view=markup>
hth
-nikhil
http://stanford.edu/~nikgupta
On Tue, Sep 15, 2009 at 3:58 AM, prasenjit mukherjee
<pr...@gmail.com>wrote:
> I would like to filter a set of rows ( of groups ) based on its arity
> of a specified field . Can I do this in my pig script :
>
> r1 = LOAD ...... AS f1,f2,f3;
> gr1 = GROUP r1 BY (f1,f2);
> gr1 = FILTER gr1 BY ARITY(r1) > 1;
>
> I didnt find any documentation on ARITY.
>
> -Prasenjit
>