Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public static class WordReduce
  2. extends Reducer<Text,IntWritable,Text,IntWritable> {
  3. private IntWritable result = new IntWritable();
  4.  
  5. public void reduce(Text key, Iterable<IntWritable> values,
  6. Context context
  7. ) throws IOException, InterruptedException {
  8. int sum = 0;
  9. for (IntWritable val : values) {
  10. sum += val.get();
  11. }
  12. result.set(sum);
  13. context.write(key, result);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement