1、简单数据求和。
有一个表格,给出了每个人在十二月和一月的收入。编写程序统计每个人的收入总和。
Name Dec Jan($)
CM 200 314
LY 2000 332
QQM 6000 333
ZYM 5000 333
BP 30 12
根据算法分析编写出下面的代码(仅关键代码):
public class Sum2 extends Configured implements Tool {
public static class MapClass extends MapReduceBase
implements Mapper<LongWritable, Text, Text, IntWritable> {
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
String fields[] = value.toString().split(",", -20);//根据","