Practical examples of MRv1 and MRv2

We will now present a MapReduce example using both the old and new MapReduce APIs.

We will now write a MapReduce program in Java that finds all the anagrams (a word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman) presents them in an input file, and finally prints all the anagrams in the output file.

Here is the AnagramMapperOldAPI.java class that uses the old MapReduce API:

import java.io.IOException; import java.util.Arrays; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reporter; import java.util.StringTokenizer; ...

Get YARN Essentials 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.