hadoop mapreduce - Retain specific entries after secondary sorting using composite key

52 Views Asked by At

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?

0

There are 0 best solutions below