本文整理汇总了Java中org.apache.hadoop.mapred.lib.LazyOutputFormat类的典型用法代码示例。如果您正苦于以下问题:Java LazyOutputFormat类的具体用法?Java LazyOutputFormat怎么用?Java LazyOutputFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LazyOutputFormat类属于org.apache.hadoop.mapred.lib包,在下文中一共展示了LazyOutputFormat类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTestLazyOutput
import org.apache.hadoop.mapred.lib.LazyOutputFormat; //导入依赖的package包/类
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);
}