Codigo Haddop
Codigo Haddop
Codigo Haddop
Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.TextOutputFormat;
@Override
throws IOException {
while (tokenizer.hasMoreTokens()) {
value.set(tokenizer.nextToken());
}
public static class Reduce extends MapReduceBase
implements
@Override
throws IOException {
int sum = 0;
while (values.hasNext()) {
sum += values.next().get();
conf.setJobName("wordcount");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
conf.setMapperClass(Map.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
JobClient.runJob(conf);