Hive 临时表

set tez.queue.name=ecbireport;
SET hive.exec.dynamic.partition =true;
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;
SET hive.exec.max.dynamic.partitions.pernode=100000;


--create temporary table 
CREATE TEMPORARY TABLE temp_order
as 
select order_id,delivery_phone,gmv,channel,paid_date
from cn_ec_bi_dl_secure.wm_order_line
where channel in ('SNG','JDDJ','WMDJ')
and paid_date >='2020-09-01' and paid_date<='2020-09-06'
;

insert overwrite table vn09jj5.test40_report
partition(channel,paid_date)
select  
 count(distinct order_id) as orders
 ,count(distinct delivery_phone) as customers
 ,sum(gmv) as sales
 ,channel,paid_date
from temp_order
where channel in ('SNG')
and paid_date >='2020-09-01' and paid_date<='2020-09-02'
group by channel,paid_date
;

insert overwrite table vn09jj5.test40_report
partition(channel,paid_date)
select  
 count(distinct order_id) as orders
 ,count(distinct delivery_phone) as customers
 ,sum(gmv) as sales
 ,channel,paid_date
from temp_order
where channel in ('JDDJ')
and paid_date >='2020-09-03' and paid_date<='2020-09-04'
group by channel,paid_date
;

insert overwrite table vn09jj5.test40_report
partition(channel,paid_date)
select  
 count(distinct order_id) as orders
 ,count(distinct delivery_phone) as customers
 ,sum(gmv) as sales
 ,channel,paid_date
from temp_order
where channel in ('WMDJ')
and paid_date >='2020-09-05' and paid_date<='2020-09-06'
group by channel,paid_date
;

 

posted @ 2021-01-25 20:44  茗::流  阅读(1038)  评论(0)    收藏  举报
如有雷同,纯属参考。如有侵犯你的版权,请联系我。