Slide 129
Slide 129 text
public class ExemploMapper extends Mapper {
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
…
context.write(new Text("summary"), new Text(year + "_" + delta));
}
}
public class ExemploReducer extends Reducer {
public void reduce(Text key, Iterable values, Context context) throws IOException, InterruptedException {
…
Text keyText=new Text("minimo" + "(" + minYear.toString() + "): ");
context.write(keyText, new FloatWritable(min));
}
}
public class ExemploDriver extends Configured implements Tool {
public int run(String[] args) throws Exception {
…
job.setInputFormatClass(TextInputFormat.class);
job.setMapOutputValueClass(Text.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(FloatWritable.class);
…
}
}