1.数据
2.需求:
统计总流量:上行流量+下限流量
3.Mapper
public class FlowCountMapper extends Mapper<LongWritable, Text, Text, FlowBean>{
@Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
//1.获取数据
String line = value.toString();
//2.切割
String[] fields = line.split("\t");
//3.封装对象 拿到关键字段 数据清洗
String phoneN = fields[1];
long upFlow = Long.parseLong(fields[fields.length - 3]);
long dfFlow = Long.parseLong(fields[fields.length - 2]);
//4.输出到reducer端13726130503 299 681 980
context.write(new Text(phoneN), new FlowBean(upFlow, dfFlow));
}
}
4.封装的数据类型
public class FlowBean implements Writab