[Solved-2 Solutions] Pig: Get top n values per group ?
The below data is already grouped and aggregated.
- For every user (wiki and tiki), we want to retrieve their top n values (let's say 2), sorted terms of 'count'. So the desired output want it to be:
How can we accomplish that?
- The below code is helps to get n values
Here is an example
- top is an inbuilt function and may throw an error so the only thing which we did was changed the name of the relation in this case and instead of
Modified that as shown below -