沉默用户数样例

定义:沉默用户,只在注册安装当天启动过,且启动时间是七(根据业务来定天数)天前;

建表:
drop table if exists silent_count;
create external table silent_count(
    dt string comment '统计日期',
    silent_count bigint comment '沉默设备数'
)comment '沉默用户数'
row format delimited fields terminal by '\t' location '/data/hive/app/silent_count';

导入数据:
insert into silent_count
    select '2021-05-22',
                count(*)
    from uv_topic
    where login_date_first=login_date_last and login_date_last<=date_add('2021-05-22',-7);

注:uv_topic表是用户访问记录

posted @ 2022-02-07 15:08  shan_zhayidian  阅读(63)  评论(0编辑  收藏  举报