Single mapper reducer jobs are used in aggregation use cases. If we want to do some aggregation the such as count, by key, then this pattern is used:
Scenario |
Counting the total/average temperature of cities |
Map (Key, Value) |
Key: city Value: Their temperatures |
Reduce |
Group by city, and take average temperature for each city |
Now let's look at a complete example of a single mapper reducer only job. For this, we will simply try to output the cityID and average temperature from the temperature.csv file seen earlier.
The following is the code:
package io.somethinglikethis;import org.apache.hadoop.conf.Configuration; ...