问题
计算每日访问用户 在之后日期的留存数
基础表 每日访问用户ID
create external table if not exists user_visit_date (
user_id bigint comment '用户ID'
)
comment '每日访问用户'
partitioned by (p_day date comment '分区日期')
stored as parquet;
解决思考
Step 1. 先算出历史访问用户 在昨日的 留存数 (关键思路)
create external table if not exists user_before_visit_date (
before_visit_date date comment '历史访问日期',
remain_count bigint comment '在visit_date留存人数'
) comment