Single mapper job

Single mapper jobs are used in transformation use cases. If we want to change only the format of data, such as some kind of transformation, then this pattern is used:

Scenario

Some cities have short names as BOS, NYC, and so on

Map (Key, Value)

Key: city Name

Value: ShortName → if city is Boston/boston then converted to BOS

 else if city is New York/new york then convert to NYC

 

Now, let's look at a complete example of a Single mapper only job. For this, we will simply try to output the cityID and temperature from the temperature.csv file seen earlier.

The following is the code:

package io.somethinglikethis; ...

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.