[Pig-user] relations count
Oct 29, 2010 at 11:01 am
I hope this is not too newbie question, but it's driving me crazy... How do
you count the records in a relation? Like DUMP, but instead of list of
records, I would like their count.
Gerrit Jansen van Vuuren
: Hi, Lets say you have a file with columns userid username location amount To count the total number of users: A = LOAD 'myfile' as (userid:long, username:chararray, location:chararray, amount:long); G = GROUP A ALL PARALLEL 40; R = FOREACH G GENERATE COUNT($1); dump R; To count the number of users by location; A = LOAD 'myfile' as (userid:long, username:chararray, location:chararray, amount:long); G = GROUP A BY location PARALLEL 40; R = FOREACH G GENERATE FLATTEN(group), COUNT($1); dump R; To
: Thanks, that helps a lot! :) Anze
why cant I count?
trying to count all tuples
COUNT sometimes returning a float value?
Error When Sorting
counting unique visits per item
Identifying the top 20% of a sorted relation
Any suggestion how to create UDFs
Filter out all rows except the first
1 of 3
Oct 29, '10 at 11:01a
Oct 29, '10 at 12:44p
2 users in discussion
Gerrit Jansen van Vuuren (1)
Groups & Organizations
site design / logo © 2021 Grokbase