小编pr_*_*_84的帖子

mapreduce计数的例子

我的问题是关于mapreduce programming in java.

假设我有WordCount.java示例,一个标准mapreduce program.我希望地图功能来收集一些信息,并返回到减少功能图形成,如:<slaveNode_id,some_info_collected>,

所以I can know what slave node collected what data..任何想法如何?

public class WordCount {

    public static class Map 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 tokenizer = new StringTokenizer(line);
        while (tokenizer.hasMoreTokens()) {
          word.set(tokenizer.nextToken()); …
Run Code Online (Sandbox Code Playgroud)

java hadoop mapreduce

8
推荐指数
1
解决办法
7523
查看次数

标签 统计

hadoop ×1

java ×1

mapreduce ×1