创建真实表:
create external table bi_rg.fact_call_logs
(callingnumber string,
callednumber string,
domain string,
frontid string,
category string,
mobile_code string,
list_type string,
barring_type string,
call_type string,
template_id string,
calling_areanumber string,
called_areanumber string,
location_number string)
partitioned by (stat_date string)
row format delimited fields terminated by ',';
导入真实表数据
insert OVERWRITE TABLE bi_rg.fact_call_logs
PARTITION (stat_date)
select
callingnumber,
callednumber,
domain,
frontid,
category,
judgeMobile(callingnumber) as monbile_code,
listtype,
barringtype,
calltype,
if(templet_no is null,"invalid",templet_no),
callingareanum,
calledareanum,
if(locationnumber is null,"invalid",locationnumber),
stat_date
from call_logs
where stat_date >= 20180101;