Single mapper reducer job

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; ...

Get Big Data Analytics with Hadoop 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.