You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "mike st. john" <ms...@gmail.com> on 2011/03/28 23:39:44 UTC

Group Concat.

Is it possible to do a group concat with pig.  i've been trying with no success.

basically the data is as follows


1234|test1
1234|test2
1234|test3
1244|test4
1244|test5
etc
etc

i'm trying to come up with.

1234|test1 test2 test3
1244|test4 test5


thanks
Mike

Re: Group Concat.

Posted by Jonathan Coveney <jc...@gmail.com>.
You could group by the first column, and then need to write a UDF that takes
every element of a bag and just spits it to a tuple. It's probably worth
thinking about why you want to do this to see if you might be able to avoid
that intermediate UDF.

2011/3/28 mike st. john <ms...@gmail.com>

> Is it possible to do a group concat with pig.  i've been trying with no
> success.
>
> basically the data is as follows
>
>
> 1234|test1
> 1234|test2
> 1234|test3
> 1244|test4
> 1244|test5
> etc
> etc
>
> i'm trying to come up with.
>
> 1234|test1 test2 test3
> 1244|test4 test5
>
>
> thanks
> Mike
>

Re: Group Concat.

Posted by 김영우 <wa...@gmail.com>.
Hi Mike,

There are my *humble* implementations for that. See the details,
http://mixellaneous.tistory.com/1060
I believe you might not read the descriptions written in Korean. Please
ignore it. The UDF code is very simple. :-)

<http://mixellaneous.tistory.com/1060>HTH,

- Youngwoo

2011/3/29 mike st. john <ms...@gmail.com>

> Is it possible to do a group concat with pig.  i've been trying with no
> success.
>
> basically the data is as follows
>
>
> 1234|test1
> 1234|test2
> 1234|test3
> 1244|test4
> 1244|test5
> etc
> etc
>
> i'm trying to come up with.
>
> 1234|test1 test2 test3
> 1244|test4 test5
>
>
> thanks
> Mike
>