You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by keeyong han <ke...@hotmail.com> on 2012/04/12 09:01:09 UTC
Extracting only the first tuple out of a bag
I have a bag consisting of tuples and I would like to extract only the first tuple out of bag. I don't know whether this is supposed to be hard but I can't think of how. Only way I can think of is to write a UDF ...
Please help :)
Thanks in advance!-Keeyong
Re: Extracting only the first tuple out of a bag
Posted by James Newhaven <ja...@gmail.com>.
You could also try the Pig DataFu Library FirstTupleFromBag -
FirstTupleFromBag<http://sna-projects.com/datafu/javadoc/0.0.4/datafu/pig/bags/FirstTupleFromBag.html>
James
On Thu, Apr 12, 2012 at 8:01 AM, keeyong han <ke...@hotmail.com> wrote:
>
> I have a bag consisting of tuples and I would like to extract only the
> first tuple out of bag. I don't know whether this is supposed to be hard
> but I can't think of how. Only way I can think of is to write a UDF ...
> Please help :)
> Thanks in advance!-Keeyong
Re: Extracting only the first tuple out of a bag
Posted by Gianmarco De Francisci Morales <gd...@apache.org>.
Hi,
TOP should do the trick
http://pig.apache.org/docs/r0.9.2/func.html#topx
Cheers,
--
Gianmarco
On Thu, Apr 12, 2012 at 09:01, keeyong han <ke...@hotmail.com> wrote:
>
> I have a bag consisting of tuples and I would like to extract only the
> first tuple out of bag. I don't know whether this is supposed to be hard
> but I can't think of how. Only way I can think of is to write a UDF ...
> Please help :)
> Thanks in advance!-Keeyong