0% found this document useful (0 votes)
18 views1 page

Wordcount - Java: Mapreduce Tutorial

mapred_tutorial5

Uploaded by

p001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Wordcount - Java: Mapreduce Tutorial

mapred_tutorial5

Uploaded by

p001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like