C3. Write a MapReduce driver program in Java for the given mapper and reducer classes thatperform a word count on a data set stored in a text file.public class Map extends Mapper {@Overridepublic void map(LongWritable key, Text value, Context context)throws IOException, InterruptedException {String[] row = value.toString().split("\t");context.write(new Text(row[2]),new IntWritable(1));}}public class Reduce extends Reducer {@Overridepublic void reduce(Text key, Iterable values, Context context)throws IOException, InterruptedException {int count = 0;for (IntWritable value:values) {count += value.get();}context.write(key, new IntWritable(count));}}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here