Buggy code:
public class GetTermCount2 extends PowerTool { private static final Logger LOG = Logger . getLogger ( GetTermCount2 . class ) ; protected static enum Statistics { Docs , Terms , SumOfDocLengths ; } private static class MyMapper extends Mapper < IntWritable , TermDocVector , Text , PairOfIntLong > { private static final Text term = new Text ( ) ; private static final PairOfIntLong pair = new PairOfIntLong ( ) ; @ Override public void map ( IntWritable key , TermDocVector doc , Context context ) throws IOException , InterruptedException { } } private static class MyCombiner extends Reducer < Text , PairOfIntLong , Text , PairOfIntLong > { private static final PairOfIntLong output = new PairOfIntLong ( ) ; @ Override public void reduce ( Text key , Iterable < PairOfIntLong > values , Context context ) throws IOException , InterruptedException { } } private static class MyReducer extends Reducer < Text , PairOfIntLong , Text , PairOfIntLong > { private static final PairOfIntLong output = new PairOfIntLong ( ) ; private int minDf ; private int maxDf ; @ Override public void setup ( Reducer . Context context ) { } @ Override public void reduce ( Text key , Iterable < PairOfIntLong > values , Context context ) throws IOException , InterruptedException { } } public static final String [ ] RequiredParameters = new String [ ] { Constants . CollectionName , Constants . IndexPath , Constants . MinDf , Constants . MaxDf } ; public String [ ] getRequiredParameters ( ) { } public GetTermCount2 ( Configuration conf ) { } public int runTool ( ) throws Exception { Configuration conf = getConf ( ) ; FileSystem fs = FileSystem . get ( conf ) ; String indexPath = conf . get ( IndexPath ) ; RetrievalEnvironment env = new RetrievalEnvironment ( indexPath , fs ) ; <START_BUG> int reduceTasks = conf . getInt ( NumReduceTasks , 0 ) ; <END_BUG> String collectionName = env . readCollectionName ( ) ; String termDocVectorsPath = env . getTermDocVectorsDirectory ( ) ; String termDfCfPath = env . getTermDfCfDirectory ( ) ; if ( ! ( fs . exists ( new Path ( indexPath ) ) ) ) { GetTermCount2 . LOG . info ( "index<seq2seq4repair_space>path<seq2seq4repair_space>doesn't<seq2seq4repair_space>existing:<seq2seq4repair_space>skipping!" ) ; return 0 ; } GetTermCount2 . LOG . info ( "PowerTool:<seq2seq4repair_space>GetTermCount2" ) ; GetTermCount2 . LOG . info ( String . format ( "<seq2seq4repair_space>-<seq2seq4repair_space>%s:<seq2seq4repair_space>%s" , CollectionName , collectionName ) ) ; GetTermCount2 . LOG . info ( String . format ( "<seq2seq4repair_space>-<seq2seq4repair_space>%s:<seq2seq4repair_space>%s" , IndexPath , indexPath ) ) ; GetTermCount2 . LOG . info ( String . format ( "<seq2seq4repair_space>-<seq2seq4repair_space>%s:<seq2seq4repair_space>%s" , NumReduceTasks , reduceTasks ) ) ; Path outputPath = new Path ( termDfCfPath ) ; if ( fs . exists ( outputPath ) ) { GetTermCount2 . LOG . info ( "TermDfCf<seq2seq4repair_space>directory<seq2seq4repair_space>exist:<seq2seq4repair_space>skipping!" ) ; return 0 ; } Job job = new Job ( getConf ( ) , ( "GetTermCount2:" + collectionName ) ) ; job . setJarByClass ( GetTermCount2 . class ) ; job . setNumReduceTasks ( reduceTasks ) ; FileInputFormat . setInputPaths ( job , new Path ( termDocVectorsPath ) ) ; FileOutputFormat . setOutputPath ( job , outputPath ) ; job . setInputFormatClass ( SequenceFileInputFormat . class ) ; job . setOutputFormatClass ( SequenceFileOutputFormat . class ) ; job . setMapOutputKeyClass ( Text . class ) ; job . setMapOutputValueClass ( PairOfIntLong . class ) ; job . setOutputKeyClass ( Text . class ) ; job . setOutputValueClass ( PairOfIntLong . class ) ; job . setMapperClass ( GetTermCount2 . MyMapper . class ) ; job . setCombinerClass ( GetTermCount2 . MyCombiner . class ) ; job . setReducerClass ( GetTermCount2 . MyReducer . class ) ; long startTime = System . currentTimeMillis ( ) ; job . waitForCompletion ( true ) ; GetTermCount2 . LOG . info ( ( ( "Job<seq2seq4repair_space>Finished<seq2seq4repair_space>in<seq2seq4repair_space>" + ( ( ( System . currentTimeMillis ( ) ) - startTime ) // 1000.0 ) ) + "<seq2seq4repair_space>seconds" ) ) ; Counters counters = job . getCounters ( ) ; env . writeCollectionTermCount ( ( ( int ) ( counters . findCounter ( GetTermCount2 . Statistics . Terms ) . getValue ( ) ) ) ) ; env . writeCollectionLength ( counters . findCounter ( GetTermCount2 . Statistics . SumOfDocLengths ) . getValue ( ) ) ; return 0 ; } }

Fix:
int reduceTasks = 10 ;