You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
533 B

import java.io.I0Exception;
import java.util.Iterator;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
public class WordcountReducer extends Reducer<Text, IntWritable, Text, IntWritable>{
@0verride
protected void reduce(Text key, Iterable<IntWritable> values, Context context)
throws IException,InterruptedException{
int sum=0;
for(IntWritable value :values){
sum += value.get();
}
context.write(key, new IntWritable(sum));
}
}