hive小例子-----手机基站掉话率

实验数据大家自己下

https://pan.baidu.com/s/1AYkb_B3GIuMGKiIbmJvV6w

建表

create table cell_monitor(

record_time string,

imei string,

cell string,

ph_num int,

call_num int,

drop_num int,

duration int,

drop_rate double,

net_type string,

erl string

)

row format delimited fields terminated by ','

stored as textfile;

创建结果表

create table cell_drop_monitor(

imei string,

total_call_num int,

total_drop_num int,

d_rate double

)

row format delimited fields terminated by '\t'

stored as  textfile;

load 数据

load data local inpath '/home/cdr_summ_imei_cell_info.csv' overwrite into table cell_monitor;

找出掉话率最高的基站

from cell_monitor cm

    insert overwrite table cell_drop_monitor

    select cm.imei,sum(cm.drop_num),sum(cm.duration),sum(cm.drop_num)/sum(cm.duration) d_rate

     group by cm.imei

      sort by d_rate desc;

猜你喜欢

转载自blog.csdn.net/paulfrank_zhang/article/details/80995951
今日推荐