Hi Ning,

Is the column “DAY” with type “date” in your hive table?


If so, maybe you can try


select 
intersect_count(user_id, "DAY", array[date’20190606']) as d1,
intersect_count(user_id, "DAY", array[date’20190606', date’20190607']) as d2,
intersect_count(user_id, "DAY", array[date’20190606', date ‘20190607', 
date’20190608']) as d3
from dm_info.kylin_usercenter_summary_detail_di
where "DAY" in (date’20190606', date’20190607', date’20190608');



Best regards,

 

Ni Chunen / George



在2019年07月11日 14:40,[email protected]<[email protected]> 写道:
我现在使用intersect_count函数来计算用户留存,但是结果都是0,很奇怪,kylin用的2.5版本。
用hive查询的时候6号,7号,8号数据都是用交集的,但是用kylin查询结果不对。是我使用的不对,还是什么原因??


select "DAY",count(distinct user_id) 
from dm_info.kylin_usercenter_summary_detail_di
where "DAY" in (20190606, 20190607, 20190608)
group by "DAY";
这条语句返回
20190608
80073
20190606
175494
20190607
119929


select 
intersect_count(user_id, "DAY", array[20190606]) as d1,
intersect_count(user_id, "DAY", array[20190606, 20190607]) as d2,
intersect_count(user_id, "DAY", array[20190606, 20190607, 20190608]) as d3
from dm_info.kylin_usercenter_summary_detail_di
where "DAY" in (20190606, 20190607, 20190608);
这条语句返回
0
0
0






[email protected]

Reply via email to