2

In wordcount example, the combiner is explicitly set in

job.setCombinerClass(IntSumReducer.class);

I would like to disable the combiner so that the output of mapper is not processed by the combiner. Is there a way to do that using MR config files (i.e. without modifying and recompiling the wordcount code)?

Thanks

3
  • Good question. When you implement ToolRunner, it allows you to pass mapreduce configuration parameters through the -D flag... but I've never seen the names of the Mapper/Reducer/Combiner classes being changed. Dec 18, 2013 at 18:46
  • Let me try to understand your question....So you want a way so that you can turn on and off combiner through some external mechanism ? As such if you don't set the combiner in first place...you won't have a combiner to deal with...so, if you can calrify your question I can have a better answer for you...
    – javadevg
    Dec 18, 2013 at 19:15
  • @javadevg sorry for the confusion. "So you want a way so that you can turn on and off combiner through some external mechanism ? As such if you don't set the combiner in first place...you won't have a combiner to deal with" yes this is my question.
    – polerto
    Dec 18, 2013 at 19:31

1 Answer 1

1

Suppose this is your command line

hadoop jar your_hadoop_job.jar your_mr_driver \
command_line_arg1 command_line_arg2 command_line_arg3 \
-libjars all_your_dependency_jars

Here following parameters

  • command_line_arg1
  • command_line_arg2
  • command_line_arg3

will be passed on to your main method as arg[0], arg[1] and arg[3] respectively. Assuming arg[0] and arg[1] is used for identifying input and output folder. You can use arg[3] to pass a boolean flag like ('1' or 'true' or 'yes') to understand if you want to use combiner and accordingly set combiner. Example below (default...it won't set combiner class)

if ( "YyesTrue1".contains(arg[3])){
    job.setCombinerClass(IntSumReducer.class);
}
1
  • This will require you to modify the Driver code not map reduce code...but yes a code modification is required with this approach. Since its your code which is overwriting the defaults to introduce the combiner...the check has to be put in there only, as that's the last level of configuration.
    – javadevg
    Dec 19, 2013 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.