Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
78 views
in Technique[技术] by (71.8m points)

java - How to write test cases for Reduce side join problems (multiple mappers and single reducer) using MultipleInputsMapReduceDriver?

I am trying to write a test case for Map Reduce program which has 2 mappers and one reducer using MultipleInputsMapReduceDriver. In Maven I tried testing the following code but got an error saying: "No Inputs was given to SecondMapper". Help me with the code.

    @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();
}
question from:https://stackoverflow.com/questions/65862463/how-to-write-test-cases-for-reduce-side-join-problems-multiple-mappers-and-sing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...