mapreduce-查找最高气温的Reducer类
来源:互联网 发布:欧洲卡车模拟2mac下载 编辑:程序博客网 时间:2024/04/28 13:54
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));
}
}
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));
}
}
0 0
- mapreduce-查找最高气温的Reducer类
- mapreduce-查找最高气温的Mapper类
- mapreduce-查找最高气温的Main类
- mapreduce实例,计算最高气温
- 权威指南MapReduce 最高气温计算
- Hadoop之Avro mapreduce最高气温程序
- MapReduce求年度最高气温值以及combiner的一点认识
- MapReduce求年度最高气温值以及combiner的一点认识
- MapReduce的Reducer数量确定
- 求每年最高气温
- hadoop2.x入门:编写mapreduce对气象数据集求每日最高气温和最低气温
- MapReduce中Reducer与reduce的关系
- mapreduce--如何设置reducer的个数
- MapReduce之气温计算
- Hadoop中求最高气温
- 027_编写MapReduce的模板类Mapper、Reducer和Driver
- hadoop-mapreduce-without-reducer
- hive mapreduce reducer 调优
- UVa 10285 - Longest Run on a Snowboard(记忆化搜索)
- Blur Images Efficiently using Renderscript
- history.back() webpage has expired. 网页已过期
- 解决异步请求时跨域访问或同源策略的问题
- NYOJ 题目1023 还是回文(dp)
- mapreduce-查找最高气温的Reducer类
- mapreduce-查找最高气温的Main类
- Linux查看程序、进程的依赖库的方法
- UVa 紫书百题留念
- VS2010中GetMenu()和GetSubMenu(0)为NULL引发异常的解决方法
- Mac下使用XMPP即时通讯【4】:openfire源码部署、二次开发
- NYOJ 题目760 See LCS again(LIS求LCS)
- Mac把socks5代理转换成http/https的代理
- Jquery树控件ZTree保持单一路径并定时刷