My reducer gives this o/p
Country-Year,Medals
India-2008,60
United States-2008,1237
Zimbabwe-2008, 2
Namibia-2009,22
China-2009,43
United States-2009,54
And i want this, sorting should happen based on medals and top three should be shown.
Country-Year,Medals
United States-2008,1237
India-2008,60
United States-2009,54
Someone suggested me to do this sorting in custom recordreader(understood that it is used in mapper part) and i browsed through some resources but couldn't find much on sorting. Please share any ideas or link to resources. Advance thanks !
You can implement Map Reduce Top K Design pattern to achieve your objective.
Top K Design pattern will sort your records on values and picks the top k records.
You can go through this link for implementing Top K Design pattern on your data.