EMERGING TRENDS IN SOFTWARE ENGINEERING
CLOUD COMPUTING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Consider the pseudo-code for MapReduce’s WordCount example (not shown here). Let’s now assume that you want to determine the average amount of words per sentence. Which part of the (pseudo-)code do you need to adapt?
|
Only map()
|
|
Only reduce()
|
|
map() and reduce()
|
|
The code does not have to be changed.
|
Explanation:
Detailed explanation-1: -In MapReduce word count example, we find out the frequency of each word. Here, the role of Mapper is to map the keys to the existing values and the role of Reducer is to aggregate the keys of common values. So, everything is represented in the form of Key-value pair.
Detailed explanation-2: -A reduce() function can iterate over key/value pairs multiple times. A call to reduce() is guaranteed to receive key/value pairs from only one key.
Detailed explanation-3: -The key is the word from the input file and value is ‘1’. This is how the MapReduce word count program executes and outputs the number of occurrences of a word in any given input file.
There is 1 question to complete.