Yes, see GROUP and COUNT. Something like this: fruits = LOAD '/my/fruit' AS (name:chararray); grouped = GROUP fruits BY name; counts = FOREACH grouped GENERATE group, COUNT(fruits); DUMP counts;
On Fri, May 4, 2012 at 9:06 AM, James Newhaven <[email protected]>wrote: > Say I have a tuple containing the following elements (Apples, Apples, > Oranges, Carrots, Carrots) > > Is it possible in pig to find the counts of the tuple, for example the > output I would like is: > > (Apples, 2) > (Oranges, 1) > (Carrots, 2) > > Thanks, > James > -- *Note that I'm no longer using my Yahoo! email address. Please email me at [email protected] going forward.*
