**我想知道下面几行的意思,我是java新手,这是我作业的一部分。
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
//According to my knowledge we are using this to set the line as a string
String line = value.toString();
//each string is now divided into indovidual words
StringTokenizer tokenizer = new StringTokenizer(line);
//How are we setting the end limit of the loop ?
while (tokenizer.hasMoreTokens()) {
//what is word.set operation is doing here?
word.set(tokenizer.nextToken());
}
//What is context ? and how are we giving the output to the reducer?
context.write(word, one);
}
1条答案
按热度按时间3bygqnnd1#
希望这能解决问题。