MapReduce Tutorial
[Link]
28. public static class Reduce
extends MapReduceBase implements
Reducer<Text, IntWritable, Text,
IntWritable> {
29. public void reduce(Text key,
Iterator<IntWritable> values,
OutputCollector<Text, IntWritable>
output, Reporter reporter) throws
IOException {
30. int sum = 0;
31. while ([Link]()) {
32. sum += [Link]().get();
33. }
34. [Link](key, new
IntWritable(sum));
35. }
36. }
37.
38. public static void main(String[]
args) throws Exception {
39. JobConf conf = new
JobConf([Link]);
40. [Link]("wordcount");
41.
42.
[Link]([Link]);
43.
[Link]([Link]);
44.
45. [Link]([Link]);
46.
[Link]([Link]);
Copyright 2008 The Apache Software Foundation. All rights reserved. Page 5