1 Answer

0 votes
by

MapReduce API

In this section, we focus on MapReduce APIs. Here, we learn about the classes and methods used in MapReduce programming.

MapReduce Mapper Class

In MapReduce, the role of the Mapper class is to map the input key-value pairs to a set of intermediate key-value pairs. It transforms the input records into intermediate records.

These intermediate records associated with a given output key and passed to Reducer for the final output.

Methods of Mapper Class

void cleanup(Context context)This method called only once at the end of the task.
void map(KEYIN key, VALUEIN value, Context context)This method can be called only once for each key-value in the input split.
void run(Context context)This method can be override to control the execution of the Mapper.
void setup(Context context)This method called only once at the beginning of the task.

MapReduce Reducer Class

In MapReduce, the role of the Reducer class is to reduce the set of intermediate values. Its implementations can access the Configuration for the job via the JobContext.getConfiguration() method.

Methods of Reducer Class

void cleanup(Context context)This method called only once at the end of the task.
void map(KEYIN key, Iterable<VALUEIN> values, Context context)This method called only once for each key.
void run(Context context)This method can be used to control the tasks of the Reducer.
void setup(Context context)This method called only once at the beginning of the task.

MapReduce Job Class

The Job class is used to configure the job and submits it. It also controls the execution and query the state. Once the job is submitted, the set method throws IllegalStateException.

Methods of Job Class

Related questions

0 votes
asked Oct 12, 2019 in Big Data | Hadoop by GeorgeBell
0 votes
asked Oct 12, 2019 in Big Data | Hadoop by RShastri
...