You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Jordi Deu-Pons <jo...@jordeu.net> on 2010/05/01 08:37:48 UTC

Re: UDF with two Bag one per group and one 'static'

Ok,

> then you can load b as a side file inside your udf.
I'll will try to implement this approach.

May be in a future it will be useful to allow a LOAD inside a FOREACH

Thanks.

On Fri, Apr 30, 2010 at 5:51 PM, Alan Gates <ga...@yahoo-inc.com> wrote:

> You need to change your group to a cogroup so that both bags are in your
> data stream.  If you don't want to group bag b by the same keys as a (that
> is, you want all of b available for each group of a) t
> Alan.
>
>
> On Apr 30, 2010, at 4:32 AM, Jordi Deu-Pons wrote:
>
>  Hi,
>>
>> I've developed an UDF that receives two bags as inputs and outputs one
>> bag.
>>
>> One of the bags is different in every group and the other is always the
>> same.
>>
>> Example code:
>>
>> A = LOAD 'a' AS (group, value);
>> B = LOAD 'b';
>> G = GROUP A BY group;
>> R = FOREACH G GENERATE FLATTEN(my.udf(A,B));
>>
>> This give an error "Error during parsing. Invalid alias: B".
>> I can understand this error, but I cannot realize another
>> way to do this.
>>
>> Do you know which is the best way to do this?
>>
>> Thanks
>>
>> --
>> a10! i fins aviat.
>> J:-Deu
>>
>
>


-- 
a10! i fins aviat.
J:-Deu