单词统计相当于编程开始的HELLO WORLD。应该都跑过。假设这里有一个文档,里面有两行这样的话:
Hello World Bye World
Hello Hadoop GoodBye Hadoop
最终要显示的结果如下:
程序如下:
public class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer itr = new S