Aggregation functions in PIG
Example1:
year
price
2015
60
2014
45
2016
34
2014
75
2015
45
2014
41
I would like to get the result as, total price of the item by year.
grunt> file = load '/tmp/yearprice.txt' using PigStorage(',') as (year:int,price:float);
grunt> data = foreach file generate year, price by $0 > 1;
grunt> group = group data by year;
grunt> sum = foreach group generate group...