Reputation: 1
Is there any way that we can know number of input splits before adding them to the output collector in mapreduce
program
I tried with below code
opCol.collect(new Text(Integer.toString(total)), new IntWritable(
Count))
Any help would appreciated. Thanks.
Upvotes: 0
Views: 590
Reputation: 37023
If you check the FileInputFormat class's getSplits method, it sets the number of split as job.getConfiguration().setLong(NUM_INPUT_FILES, files.size());
So from your mapper using int splitCount = context.getConfiguration().get("mapreduce.input.fileinputformat.numinputfiles");
Upvotes: 2