小智 5
我也在寻找同样的东西.我确实得到了答案,尽管我迟到了,我认为分享这个可能对某人有所帮助.
从Hadoop 2.0开始,您可以在包org.apache.hadoop.mapreduce.lib.chain中找到ChainMapper和ChainReducer.
ChainMapper使用模式:...
Job job = new Job(conf, "MyJob");
Configuration map1Conf = new Configuration(false);
... ChainMapper.addMapper(job, AMap.class, LongWritable.class, Text.class, Text.class, Text.class, true, map1Conf);
Configuration map2Conf = new Configuration(false);
... ChainMapper.addMapper(job, BMap.class, Text.class, Text.class, LongWritable.class, Text.class, false, map2Conf);
Configuration map3Conf = new Configuration(false);
... ChainReducer.setReducer(job, CReducer.class, Text.class, Text.class, LongWritable.class, Text.class, false, map3Conf);
...
job.waitForComplettion(true);
...
Run Code Online (Sandbox Code Playgroud)