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
;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM