You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Jonathan Holloway <jo...@gmail.com> on 2011/04/08 03:45:26 UTC
Merging lines in a log into a single bag
Hi all,
I have the following:
A {(3),(Log Message A)}
A {(5),(Log Message B)}
B {(8),(Log Message C)}
B {(1),(Log Message D)}
C {(2),(Log message E)}
C {(7),(Log message F)}
and I want to merge the related line letters (A, B, C) into the same bag:
A {(3),(Log Message A), (5),(Log Message B)}
B {(8),(Log Message C), (1),(Log Message D)}
C {(2),(Log message E), (7),(Log message F)}
How would I go about doing this with Pig?
Many thanks in advance,
Jon.
Re: Merging lines in a log into a single bag
Posted by Mridul Muralidharan <mr...@yahoo-inc.com>.
You could group by first column ?
Please refer to the pig manual for more on this.
Regards,
Mridul
On Friday 08 April 2011 07:15 AM, Jonathan Holloway wrote:
> Hi all,
>
> I have the following:
>
> A {(3),(Log Message A)}
> A {(5),(Log Message B)}
> B {(8),(Log Message C)}
> B {(1),(Log Message D)}
> C {(2),(Log message E)}
> C {(7),(Log message F)}
>
> and I want to merge the related line letters (A, B, C) into the same bag:
>
> A {(3),(Log Message A), (5),(Log Message B)}
> B {(8),(Log Message C), (1),(Log Message D)}
> C {(2),(Log message E), (7),(Log message F)}
>
> How would I go about doing this with Pig?
>
> Many thanks in advance,
>
> Jon.