While working on Secondary sort issue from the definitive guide , I came across a code like this :
@Override
public int getPartition(TextpairWritable tp, IntWritable value, int numPartitions) {
return Math.abs(Integer.parseInt(tp.getyear().toString()) * 127) % numPartitions;
}
I want to understand what is the meaning of line:
return Math.abs(Integer.parseInt(tp.getyear().toString()) * 127) % numPartitions;
If I don't tell the number of reducers in driver code, how does hadoop know the value of this parameter in above line. what is the significance of multiplying it with 127 ?