我正在學習Apache Hadoop,我正在查看WordCount示例org.apache.hadoop.examples.WordCount。我已經明白這個例子,不過,我可以看到變量LongWritable關鍵沒有在org.apache.hadoop.mapred.Mapper中'key K1'的用法是什麼?
(...)
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer itr = new StringTokenizer(line);
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
output.collect(word, one);
}
}
(...)
什麼用這個變量的使用?有人能給我一個簡單的例子嗎? 謝謝