1. package Ds_mapreducd;2.3. import java.io.IOException;4.5. import org.apache.hadoop.conf.Configuration;6. import org.apache.hadoop.fs.Path;7. import org.apache.hadoop.io.IntWritable;8. import org.apache.hadoop.io.LongWritable;9. import org.apache.hadoop.io.Text;10. import org.apache.had...
0x02 编写代码 1. 需求1:按日期进行统计 完整代码如下: package com.shaonaiyi.mapreduce;import java.io.IOException;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.IntWritable;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapreduce....
public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String[] line = value.toString().split("\\s+");pValue.set(Double.parseDouble(line[1]));pId.set(new Text(line[0]));context.write(pValue, pId);} } public static class Reduce extends Redu...