Skip to content

Instantly share code, notes, and snippets.

@rei999
Created July 10, 2013 00:59
Show Gist options
  • Select an option

  • Save rei999/5962674 to your computer and use it in GitHub Desktop.

Select an option

Save rei999/5962674 to your computer and use it in GitHub Desktop.
example hadoop mapper
package com.mycompany.emr;
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import com.mycompany.emr.EmployeeRecord;
public class Map extends Mapper<LongWritable, EmployeeRecord, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
public void map(LongWritable key, EmployeeRecord value, Context context) throws IOException, InterruptedException {
context.write(new Text(value.title), one);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment