Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import org.apache.hadoop.io.IntWritable;
- import org.apache.hadoop.io.LongWritable;
- import org.apache.hadoop.io.Text;
- import org.apache.hadoop.mapreduce.Mapper;
- public class WordCountMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
- @Override
- public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
- String line = value.toString();
- for (String word : line.split("\\W+")) {
- if (word.length() > 0) {
- context.write(new Text(word), new IntWritable(1));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement