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