MapMultipleValuesReducer.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:HadoopHowTo 作者:
@Override
public void reduce(Text key, Iterable<MapWritable> values, Context context)
        throws IOException, InterruptedException {

    for (MapWritable value : values) {

        int i = ((IntWritable) value.get(new IntWritable(1))).get();
        float f = ((FloatWritable) value.get(new IntWritable(2))).get();
        String s = ((Text) value.get(new IntWritable(3))).toString();

        mw.put(new IntWritable(1), new IntWritable(i * 2));
        mw.put(new IntWritable(2), new FloatWritable(f * 2));
        mw.put(new IntWritable(3), new Text(s));

        context.write(key, mw);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号