我的问题是关于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)