Reputation: 11
I have done a secondary sorting using composite key (hadoop mapreduce java). The sorted data looks like:
(asec) (desc) (asec)
id num price
1 10 9
1 10 10
1 8 7
2 10 9
2 8 12
(id, num) is the composite key.
The expected result is:
id num price
1 10 9
2 10 9
That is, for each id, get the largest num and lowest price (if there are some same largest nums).
How should I write the reduce method to finish this step?
Upvotes: 1
Views: 42