private static void runTestLazyOutput(JobConf job, Path output, int numReducers, boolean createLazily) throws Exception { job.setJobName("test-lazy-output"); FileInputFormat.setInputPaths(job, INPUT); FileOutputFormat.setOutputPath(job, output); job.setInputFormat(TextInputFormat.class); job.setMapOutputKeyClass(LongWritable.class); job.setMapOutputValueClass(Text.class); job.setOutputKeyClass(LongWritable.class); job.setOutputValueClass(Text.class); job.setMapperClass(TestMapper.class); job.setReducerClass(TestReducer.class); JobClient client = new JobClient(job); job.setNumReduceTasks(numReducers); if (createLazily) { LazyOutputFormat.setOutputFormatClass (job, TextOutputFormat.class); } else { job.setOutputFormat(TextOutputFormat.class); } JobClient.runJob(job); }