Java MapReduce
Having run through how the MapReduce program works, the next step is to express it in code.
We need three things: a map function, a reduce function, and some code to run the job. The map function is represented by the Mapper class, which declares an abstract map() method.

Java MapReduce

if (airTemperature Is MISSING && quality, matches(“[01459]”)){
context.write(new Text(year), new In writable (airTemperature));
The Mapper class is a generic type, with four formal type parameters that specify input key, input value, output key, and output value types of the map function.
The map() method is passed a key and a value. We convert the Text value conta the line of input into a Java String, then use its substring() method to extra columns we are interested in.The map() method also provides an instance of Context to write the output too.