Q :all the files have sorted data but these files itself are not sorted..
Ans: A custom hashpartitioner is used by default to split intermediate output (from mapper).
Example:
If the intermediate values are 3,4,5,6,7,8,9,10,11 Then the data will be partitioned into (lets say) Reducer: R1{7,4,10} R2{5,11,8} R3{9,6,3}
So now flat files will have
Part-00000 {4,,7,11} Part-00001 {5,8,11} Part-00002 {3,6,9}
If you are looking for sorting by value: Here is ans
source share