有一个JAVA写的map-reduce job,mapper输出的key、value类型分别为Text、NullWritable,所以reducer应该像下面这样写:
static class QuerySegmentResultFromKVReducer extends Reducer<Text, NullWritable, NullWritable, NullWritable> {
@Override
protected void setup(Reducer.Context context) throws IOException, InterruptedException {
}
@Override
protected void cleanup(Reducer.Context context) throws IOException, InterruptedException {
}
@Override
protected void reduce(Text key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
//TODO:
}
}
在这里,reducer输出的key、value类型都是NullWritable,我们不用关心,这不是本文的关注点。