PrepAway - Latest Free Exam Questions & Answers

How many times will the Reducer’s reduce method be invoked?

You have written a Mapper which invokes the following five calls to the OutputColletor.collect
method:
output.collect (new Text (“Apple”), new Text (“Red”) ) ;
output.collect (new Text (“Banana”), new Text (“Yellow”) ) ;
output.collect (new Text (“Apple”), new Text (“Yellow”) ) ;
output.collect (new Text (“Cherry”), new Text (“Red”) ) ;
output.collect (new Text (“Apple”), new Text (“Green”) ) ;
How many times will the Reducer’s reduce method be invoked?

PrepAway - Latest Free Exam Questions & Answers

A.
6

B.
3

C.
1

D.
0

E.
5

Explanation:
reduce() gets called once for each [key, (list of values)] pair. To explain, let’s say
you called:
out.collect(new Text(“Car”),new Text(“Subaru”);
out.collect(new Text(“Car”),new Text(“Honda”);
out.collect(new Text(“Car”),new Text(“Ford”);
out.collect(new Text(“Truck”),new Text(“Dodge”);
out.collect(new Text(“Truck”),new Text(“Chevy”);
Then reduce() would be called twice with the pairs

reduce(Car, <Subaru, Honda, Ford>)
reduce(Truck, <Dodge, Chevy>)
Reference: Mapper output.collect()?

2 Comments on “How many times will the Reducer’s reduce method be invoked?


Leave a Reply

Your email address will not be published. Required fields are marked *