Buggy code:
public class WikiStats { static final String PERIOD_PARAM_NAME = "DayPeriod" ; static final String LANGUAGES_PARAM_NAME = "NumberOfLanguages" ; static final String PAGES_PARAM_NAME = "NumberOfPages" ; private static final int INPUT_ARGS_INDEX = 0 ; private static final int PAGES_ARGS_INDEX = 1 ; private static final int LANGUAGES_ARGS_INDEX = 2 ; private static final int PERIOD_ARGS_INDEX = 3 ; private static final String JOB_1_SUBFOLDER = "//job1" ; private static final String JOB_2_SUBFOLDER = "//job2" ; private static final String JOB_3_SUBFOLDER = "//job3" ; private static final String JOB_4_SUBFOLDER = "//job4" ; public static void main ( String [ ] args ) throws Exception { if ( ( args . length ) != 4 ) { System . err . println ( "Usage:<seq2seq4repair_space>WikiStats<seq2seq4repair_space><in><seq2seq4repair_space><out><seq2seq4repair_space><pages><seq2seq4repair_space><languages><seq2seq4repair_space><period>" ) ; System . exit ( ( - 1 ) ) ; } String pages = args [ WikiStats . PAGES_ARGS_INDEX ] ; String languages = args [ WikiStats . LANGUAGES_ARGS_INDEX ] ; String period = args [ WikiStats . PERIOD_ARGS_INDEX ] ; Path job1InputPath = new Path ( args [ WikiStats . INPUT_ARGS_INDEX ] ) ; Path job1OutputPath = new Path ( ( "output" + ( WikiStats . JOB_1_SUBFOLDER ) ) ) ; Path job2InputPath = job1OutputPath ; Path job2OutputPath = new Path ( ( "output" + ( WikiStats . JOB_2_SUBFOLDER ) ) ) ; Path job3InputPath = job1OutputPath ; Path job3OutputPath = new Path ( ( "output" + ( WikiStats . JOB_3_SUBFOLDER ) ) ) ; Path job4InputPath_1 = job2OutputPath ; <START_BUG> Path job4InputPath_2 = job2OutputPath ; <END_BUG> Path job4OutputPath = new Path ( ( "output" + ( WikiStats . JOB_4_SUBFOLDER ) ) ) ; Configuration conf1 = new Configuration ( ) ; Configuration conf2 = new Configuration ( ) ; Configuration conf3 = new Configuration ( ) ; Configuration conf4 = new Configuration ( ) ; conf1 . set ( "mapred.textoutputformat.separator" , ";" ) ; conf1 . set ( WikiStats . PAGES_PARAM_NAME , pages ) ; conf1 . set ( WikiStats . LANGUAGES_PARAM_NAME , languages ) ; conf1 . set ( WikiStats . PERIOD_PARAM_NAME , period ) ; conf2 . set ( "mapred.textoutputformat.separator" , ";" ) ; conf2 . set ( WikiStats . PAGES_PARAM_NAME , pages ) ; conf2 . set ( WikiStats . LANGUAGES_PARAM_NAME , languages ) ; conf2 . set ( WikiStats . PERIOD_PARAM_NAME , period ) ; conf3 . set ( "mapred.textoutputformat.separator" , ";" ) ; conf3 . set ( WikiStats . PAGES_PARAM_NAME , pages ) ; conf3 . set ( WikiStats . LANGUAGES_PARAM_NAME , languages ) ; conf3 . set ( WikiStats . PERIOD_PARAM_NAME , period ) ; conf4 . set ( WikiStats . PAGES_PARAM_NAME , pages ) ; conf4 . set ( WikiStats . LANGUAGES_PARAM_NAME , languages ) ; conf4 . set ( WikiStats . PERIOD_PARAM_NAME , period ) ; Job job1 = new Job ( conf1 , "job1" ) ; job1 . setJarByClass ( WikiStats . class ) ; job1 . setMapperClass ( Job1Mapper . class ) ; job1 . setReducerClass ( Job1Reducer . class ) ; job1 . setOutputKeyClass ( Text . class ) ; job1 . setOutputValueClass ( Text . class ) ; job1 . setNumReduceTasks ( 64 ) ; FileInputFormat . addInputPath ( job1 , job1InputPath ) ; FileOutputFormat . setOutputPath ( job1 , job1OutputPath ) ; job1 . waitForCompletion ( true ) ; Job job2 = new Job ( conf2 , "job2" ) ; job2 . setJarByClass ( WikiStats . class ) ; job2 . setMapperClass ( Job2Mapper . class ) ; job2 . setReducerClass ( Job2Reducer . class ) ; job2 . setPartitionerClass ( SortSpikePartitioner . class ) ; job2 . setGroupingComparatorClass ( GroupingComparator . class ) ; job2 . setSortComparatorClass ( SortComparator . class ) ; job2 . setOutputKeyClass ( Text . class ) ; job2 . setOutputValueClass ( Text . class ) ; job2 . setNumReduceTasks ( 64 ) ; FileInputFormat . addInputPath ( job2 , job2InputPath ) ; FileOutputFormat . setOutputPath ( job2 , job2OutputPath ) ; job2 . waitForCompletion ( true ) ; Job job3 = new Job ( conf3 , "job3" ) ; job3 . setJarByClass ( WikiStats . class ) ; job3 . setMapperClass ( Job3Mapper . class ) ; job3 . setReducerClass ( Job3Reducer . class ) ; job3 . setOutputKeyClass ( Text . class ) ; job3 . setOutputValueClass ( IntWritable . class ) ; FileInputFormat . addInputPath ( job3 , job3InputPath ) ; FileOutputFormat . setOutputPath ( job3 , job3OutputPath ) ; job3 . waitForCompletion ( true ) ; Job job4 = new Job ( conf4 , "job4" ) ; job4 . setJarByClass ( WikiStats . class ) ; job4 . setMapperClass ( Job4Mapper . class ) ; job4 . setReducerClass ( Job4Reducer . class ) ; job4 . setMapOutputKeyClass ( IntWritable . class ) ; job4 . setMapOutputValueClass ( Text . class ) ; job4 . setOutputKeyClass ( Text . class ) ; job4 . setOutputValueClass ( Text . class ) ; FileInputFormat . addInputPath ( job4 , job4InputPath_1 ) ; FileInputFormat . addInputPath ( job4 , job4InputPath_2 ) ; FileOutputFormat . setOutputPath ( job4 , job4OutputPath ) ; job4 . waitForCompletion ( true ) ; System . exit ( 0 ) ; } }

Fix:
Path job4InputPath_2 = job3OutputPath ;