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

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

我正在尝试为map reduce程序编写一个测试用例,它有两个Map器和一个使用multipleinputsmapreducedriver的reducer。在maven中,我尝试测试以下代码,但出现了一个错误:“没有向secondmapper提供任何输入”。帮我查一下密码。

  1. @Test
  2. public testMapReduceDriver() throws IOException,
  3. InterruptedException {
  4. Text value1 = new Text("wds,sd,Male,Divorce,8-5-2000");
  5. Text value2 = new Text("as,wds,asd,2.3,Cas,1/2/2011");
  6. Text value3 = new Text("ds,wds,assad,4.3,Cash,2/1/2019");
  7. new MultipleInputsMapReduceDriver<Text, Text, Text, Text>()
  8. .withMapper(new FirstMapper())
  9. .withMapper(new SecondMapper())
  10. .withReducer(new SingleReducer())
  11. .withAll(new FirstMapper(), Arrays.asList((new Pair<LongWritable, Text>(new LongWritable(0), value1))))
  12. .withAll(new SecondMapper(), Arrays.asList((new Pair<LongWritable, Text>(new LongWritable(20), value2)),
  13. (new Pair<LongWritable, Text>(new LongWritable(10), value3))))
  14. .withAllOutput(Arrays.asList(new Pair<Text,Text>(new Text("Male"),new Text("6.6"))))
  15. .runTest();
  16. }

暂无答案!

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

相关问题