Commit 08d2848d authored by 王志伟's avatar 王志伟

统计新指标,device_clk_imp_reason

parent 27a2fc41
......@@ -773,17 +773,15 @@ object find_reason {
//1.当天老用户中的点击用户数
val old_clk_count = sc.sql(
s"""
|select stat_date,count(oc.device_id) as old_clk_count
|from all_clk_diary_card oc left join device_id_old
|select '${stat_date}' as stat_date,count(oc.device_id) as old_clk_count
|from all_clk_diary_card oc innner join device_id_old
|on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
|group by stat_date
""".stripMargin
)
//1.1有点击的老用户
val old_clk_device = sc.sql(
s"""
|select oc.device_id as device_id
|select distinct(oc.device_id) as device_id
|from all_clk_diary_card oc left join device_id_old
|on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
......@@ -806,7 +804,7 @@ object find_reason {
//2.1 有点击的新用户
val new_clk_device = sc.sql(
s"""
|select oc.device_id as device_id
|select distinct(oc.device_id) as device_id
|from all_clk_diary_card oc left join device_id_new
|on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null
......@@ -819,7 +817,7 @@ object find_reason {
val old_count = sc.sql(
s"""
|select '${stat_date}' as stat_date,count(dio.device_id) as old_count
|select '${stat_date}' as stat_date,count(distinct(dio.device_id)) as old_count
|from device_id_old dio left join agency_id
|on dio.device_id = agency_id.device_id
|where agency_id.device_id is null
......@@ -829,7 +827,7 @@ object find_reason {
//4.当天新用户数
val new_count = sc.sql(
s"""
|select '${stat_date}' as stat_date,count(din.device_id) as new_count
|select '${stat_date}' as stat_date,count(distinct(din.device_id)) as new_count
|from device_id_new din left join agency_id
|on din.device_id = agency_id.device_id
|where agency_id.device_id is null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment