|
@@ -47,9 +47,6 @@ import org.apache.hadoop.mapred.MapReduceBase;
|
|
*/
|
|
*/
|
|
public class WordCount {
|
|
public class WordCount {
|
|
|
|
|
|
- // These are just for testing counters
|
|
|
|
- private enum Counter { WORDS, VALUES }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Counts the words in each line.
|
|
* Counts the words in each line.
|
|
* For each line of input, break the line into words and emit them as
|
|
* For each line of input, break the line into words and emit them as
|
|
@@ -68,7 +65,6 @@ public class WordCount {
|
|
while (itr.hasMoreTokens()) {
|
|
while (itr.hasMoreTokens()) {
|
|
word.set(itr.nextToken());
|
|
word.set(itr.nextToken());
|
|
output.collect(word, one);
|
|
output.collect(word, one);
|
|
- reporter.incrCounter(Counter.WORDS, 1);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -84,7 +80,6 @@ public class WordCount {
|
|
int sum = 0;
|
|
int sum = 0;
|
|
while (values.hasNext()) {
|
|
while (values.hasNext()) {
|
|
sum += ((IntWritable) values.next()).get();
|
|
sum += ((IntWritable) values.next()).get();
|
|
- reporter.incrCounter(Counter.VALUES, 1);
|
|
|
|
}
|
|
}
|
|
output.collect(key, new IntWritable(sum));
|
|
output.collect(key, new IntWritable(sum));
|
|
}
|
|
}
|