如何解决如何使用 MultipleInputsMapReduceDriver 为 Reduce 边连接问题多个映射器和单个减速器编写测试用例?
我正在尝试为 Map Reduce 程序编写一个测试用例,该程序有 2 个映射器和一个使用 MultipleInputsMapReduceDriver 的 reducer。在 Maven 中,我尝试测试以下代码,但收到一条错误消息:“没有向 SecondMapper 提供输入”。帮我写代码。
@Test
public testMapReduceDriver() throws IOException,InterruptedException {
Text value1 = new Text("wds,sd,Male,Divorce,8-5-2000");
Text value2 = new Text("as,wds,asd,2.3,Cas,1/2/2011");
Text value3 = new Text("ds,assad,4.3,Cash,2/1/2019");
new MultipleInputsMapReduceDriver<Text,Text,Text>()
.withMapper(new FirstMapper())
.withMapper(new SecondMapper())
.withReducer(new SingleReducer())
.withAll(new FirstMapper(),Arrays.asList((new Pair<LongWritable,Text>(new LongWritable(0),value1))))
.withAll(new SecondMapper(),Text>(new LongWritable(20),value2)),(new Pair<LongWritable,Text>(new LongWritable(10),value3))))
.withAllOutput(Arrays.asList(new Pair<Text,Text>(new Text("Male"),new Text("6.6"))))
.runTest();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。