Hive 查找app每天的新增用户

本文介绍了如何使用Hive来查找应用每天的新增用户。首先抽取当天活跃用户,然后与历史用户数据对比找出新增用户,并将这些用户添加到历史记录表中,最后对新增用户进行多维度统计。
摘要由CSDN通过智能技术生成

新增用户

思路:
1:抽取出来当天活跃用户 etl_user_active_day,
2: 拿当天活跃用户跟历史用户做对比(得出当日的新增用户)
3:增加新增用户到历史记录表里面
4:对当日新增用户进行各维度统计

/**  历史用户表  **/
create table etl_history_user(uid string);

/**   创建一个每日新增用户表   **/
create table etl_user_new_day(
   uid string,
   commit_time string,
   city string,
   release_channel string,
   app_ver_name string
)partitioned by (day string);



/**   创建维度聚合的   **/
create table dim_user_new(
   city string,
   release_channel string,
   app_ver_name string,
   newnew_cnt int
)partitioned by (day string,flag string);

/**   etl_user_new_day  ***/

/**  新增用户  20170101  **/
insert into table etl_user_new_day partition(day="20170101")
select 
   a.uid,a.commit_time,a.city,a.release_channel,a.app_ver_name
from etl_user_active_day a
left join
etl_history_user b
on a.uid=b.uid
where a.day="20170101" and b.uid is null;


/** 把新增用户插入到历史记录表里面 **/
insert 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值