1 2 3 4 5 6 7 8 9 10 11 12 13
|
class M1 extends Mapper<LongWritable, Text, Text, Text> {
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {context.write(new Text("M1"),new Text("M1v"));}
}
class R1 extends Reducer<Text, Text, LongWritable, LongWritable> {
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {context.write(new LongWritable(1), new LongWritable(1));}
}
class M2 extends Mapper<LongWritable, Text, IntWritable, IntWritable> {
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {context.write(new IntWritable(1),new IntWritable(2));}
}
class R2 extends Reducer<IntWritable, IntWritable, IntWritable, IntWritable> {
public void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {context.write(key, values.iterator().next());}
} |
Partager