side连接问题(多个Map器和单个reducer)编写测试用例?

eit6fx6z  于 2021-07-15  发布在  Hadoop
关注(0)|答案(0)|浏览(242)

我正在尝试为map reduce程序编写一个测试用例,它有两个Map器和一个使用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,wds,assad,4.3,Cash,2/1/2019");

    new MultipleInputsMapReduceDriver<Text, 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(), Arrays.asList((new Pair<LongWritable, 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();
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题