Other posts in this series:. This post covers the pattern of secondary sorting, found in chapter 3 of Data-Intensive Text Processing with MapReduce. While Hadoop automatically sorts data emitted by mappers before being sent to reducers, what can you do if you also want to sort by value? You use secondary sorting of course. With a slight manipulation to the format of the key object, secondary sorting gives us the ability to take the value into account during the sort phase. There are two possible approaches here.
These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators. Bitwise operator works on bits and performs bit by bit operation.
Java Comparator interface used to sort a array or list of objects based on custom order. Custom ordering of elements is imposed by implementing Comparator. Java Comparator interface imposes a total ordering on the objects which may not have a natural ordering. For example, for a list of elpmoyees object, the natural order may be order by employee id. But in real life applications, we may want to sort the list of employees by their first name, date of birth or simply any other such criteria.