码迷,mamicode.com
首页 > 其他好文 > 详细

mapreduce-查找最高气温的Reducer类

时间:2015-02-01 02:01:40      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:

package com;


import java.io.IOException;


import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;


public class MaxTemperatureReducer extends Reducer<Text, IntWritable, Text, IntWritable>{
@Override
public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
int maxValue = Integer.MIN_VALUE;
for(IntWritable value : values){
maxValue = Math.max(maxValue, value.get());
}
context.write(key, new IntWritable(maxValue));
}

}

mapreduce-查找最高气温的Reducer类

标签:

原文地址:http://blog.csdn.net/u012965373/article/details/43355581

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!