1. 资源中心--创建文件
脚本:
#!/bin/bash
hive <<EOF
alter table app.app_bi_test drop partition (dayid='$1');
insert overwrite table app.app_bi_test partition(dayid)
select a.Ccode,a.inCcode ,a.Cname ,'$1',COALESCE(b.num,0) ,COALESCE(c.c_num,0) ,
concat(case when COALESCE(c.c_num,0)=0 then 0 else round(COALESCE(b.num,0)/c.c_num*100,2) end ,'%') ,
COALESCE(b.num,0) ,COALESCE(c.c_num,0) ,
concat(case when COALESCE(c.c_num,0)=0 then 0 else round(COALESCE(b.num,0)/c.c_num*100,2) end ,'%') ,
substr('$1',1,4),substr('$1',1,7),date_format(current_timestamp,'yyyy-MM-dd HH:mm:ss'),'$1'
from dim.dim_test a
left join (select * from dws.dws_test_byday where dayid='$1') b on a.Ccode=b.Ccode
left join (select * from dwd.dwd_users where dayid='$1') c on a.Ccode=c.CCode;
EOF
echo 'done'
exit 0
2. 调用sell脚本
2.1 拖拽一个shell节点
2.2 编辑shell节点