15. 数据仓库分层之DWS层、ADS层--沉默用户数
文章目录
沉默用户数:只在安装当天启动过,且启动时间在一周(或月)前。
- DWS层使用日活明细表作为数据
-
ADS层沉默设备数表。
hive (gmall)> drop table if exists ads_slient_count; create external table ads_slient_count( `dt` string COMMENT '统计日期', `slient_count` bigint COMMENT '沉默设备数' ) row format delimited fields terminated by '\t' location '/warehouse/gmall/ads/ads_slient_count'; -
导入数据
insert into table ads_slient_count select '2020-02-03', count(*) from ( select mid_id from dws_uv_detail_day where dt<='2020-02-03' group by mid_id having count(*)=1 and min(dt)<=date_add('2020-02-03',-7) )t1; -
查询
hive (gmall)> select * from ads_slient_count;
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论