Slide 15
Slide 15 text
Word Count as MapReduce: Reducer
● Hadoop groups values with
same key
● Reducer pseudocode
reducer (word, values):
sum = 0
for each value in values:
sum = sum + value
emit (word, sum)
● Output of mapper stage
(hello, 1) (this, 1) (is, 1) (the, 1)
(first, 1) (file, 1)
(this, 1) (is, 1) (the, 1) (second, 1)
(file, 1)
● Input to reducer stage
(hello, [1]) (this, [1, 1]) (is, [1, 1])
(the, [1,1]) (first, [1]) (file, [1, 1])
(second, [1])
● Output of reducer stage
(hello, 1) (this, 2) (is, 2) (the, 2)
(first, 1) (file, 2) (second, 1)