由于PV,UV,VV,IP等指标对后面的计算有很大的方便,所以我们可以创建dw_webflow_basic_info表来存放某一天的PV,UV,VV,IP等指标。
-- 创建表格 create table dw_webflow_basic_info(month string,day string, pv bigint,uv bigint ,ip bigint, vv bigint) partitioned by(datestr string); --导入数据 insert into table dw_webflow_basic_info partition(datestr="20181101") select '201811','01',a.*,b.* from (select count(*) as pv,count(distinct remote_addr) as uv,count(distinct remote_addr) as ips from ods_weblog_detail where datestr ='20181101') a join (select count(distinct session) as vvs from ods_click_stream_visit where datestr ="20181101") b;执行结果:
