Created
July 10, 2013 00:59
-
-
Save rei999/5962674 to your computer and use it in GitHub Desktop.
example hadoop mapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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