For example in map reduce program, I have given number of reduce tasks as 3 and custom Partitioner returns value 5
for a condition then what will happen?
Its a Question which may be silly please clarify me
Thanks in advance
For example in map reduce program, I have given number of reduce tasks as 3 and custom Partitioner returns value 5
for a condition then what will happen?
Its a Question which may be silly please clarify me
Thanks in advance
There are two sides to your question.
If partitions is less than reducers, then reducers get wasted. So you re not utilizing them fully.
If partitions are more than reducer, then the record gets thrown away, as per Hadoop Definitive Guide. Means no reducer would pick it up, and it is gone.
If the reducer number returned by partitioner is not available, those records would be thrown away. So do not play around with custom partitioner.
Have a look at error free solution.
InputSampler.Sampler<IntWritable, Text> sampler =
new InputSampler.RandomSampler<IntWritable, Text>(0.1, 100);
InputSampler.writePartitionFile(conf, sampler);
conf.setPartitionerClass(TotalOrderPartitioner.class);
Have a look at this article for more details on partitioning