MapReduce案例-wordcount-Map阶段代码

public class WordCountMapper extends
	Mapper<LongWritable,Text,Text,LongWritable> {
	
	@Override
	public void map(LongWritable key, Text value, Context context) throws
		IOException, InterruptedException {
			String line = value.toString();
			String[] split = line.split(",");
			for (String word : split) {
			context.write(new Text(word),new LongWritable(1));
		}
	}
	
}
发布了2209 篇原创文章 · 获赞 50 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/Leon_Jinhai_Sun/article/details/104486040
今日推荐