|
|
-
pig support for in operator
Haitao Yao 2012-12-14, 02:07
hi, all Can pig support in operator, like this:
A = load 'test_data' as (value); B = filter A by value in (1,2,3,4,5);
I think this is really useful. thanks. Haitao Yao [EMAIL PROTECTED] weibo: @haitao_yao Skype: haitao.yao.final
-
Re: pig support for in operator
Young Ng 2012-12-14, 02:26
I think you can accomplish this task by writing a UDF which takes two arguments, one for the check list, the other for the value to check, and return a boolean to indicate if it's true. Young Wu On Dec 13, 2012, at 6:07 PM, Haitao Yao <[EMAIL PROTECTED]> wrote:
> hi, all > Can pig support in operator, like this: > > A = load 'test_data' as (value); > B = filter A by value in (1,2,3,4,5); > > I think this is really useful. > thanks. > > Haitao Yao > [EMAIL PROTECTED] > weibo: @haitao_yao > Skype: haitao.yao.final >
-
Re: pig support for in operator
Jonathan Coveney 2012-12-14, 07:03
This is a join. This is equivalent to.
A = load 'test_data' as (value); B = foreach 'filter_data' as (x:int); C = join A by value, B by x using 'replicated'; D = foreach C generate value as value;
One thing pig does not currently do nicely is let you create a relation from nothing (ie define the relation to filter against inline) but this can be worked around easily and the point remains. 2012/12/13 Young Ng <[EMAIL PROTECTED]>
> I think you can accomplish this task by writing a UDF which takes two > arguments, > one for the check list, the other for the value to check, and return a > boolean > to indicate if it's true. > > > Young Wu > > On Dec 13, 2012, at 6:07 PM, Haitao Yao <[EMAIL PROTECTED]> wrote: > > > hi, all > > Can pig support in operator, like this: > > > > A = load 'test_data' as (value); > > B = filter A by value in (1,2,3,4,5); > > > > I think this is really useful. > > thanks. > > > > Haitao Yao > > [EMAIL PROTECTED] > > weibo: @haitao_yao > > Skype: haitao.yao.final > > > >
|
|