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

统计新指标,device_clk_imp_reason

parent 27a2fc41
...@@ -773,17 +773,15 @@ object find_reason { ...@@ -773,17 +773,15 @@ object find_reason {
//1.当天老用户中的点击用户数 //1.当天老用户中的点击用户数
val old_clk_count = sc.sql( val old_clk_count = sc.sql(
s""" s"""
|select stat_date,count(oc.device_id) as old_clk_count |select '${stat_date}' as stat_date,count(oc.device_id) as old_clk_count
|from all_clk_diary_card oc left join device_id_old |from all_clk_diary_card oc innner join device_id_old
|on oc.device_id = device_id_old.device_id |on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
|group by stat_date
""".stripMargin """.stripMargin
) )
//1.1有点击的老用户 //1.1有点击的老用户
val old_clk_device = sc.sql( val old_clk_device = sc.sql(
s""" 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 |from all_clk_diary_card oc left join device_id_old
|on oc.device_id = device_id_old.device_id |on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null |where device_id_old.device_id is not null
...@@ -806,7 +804,7 @@ object find_reason { ...@@ -806,7 +804,7 @@ object find_reason {
//2.1 有点击的新用户 //2.1 有点击的新用户
val new_clk_device = sc.sql( val new_clk_device = sc.sql(
s""" 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 |from all_clk_diary_card oc left join device_id_new
|on oc.device_id = device_id_new.device_id |on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null |where device_id_old.device_id is not null
...@@ -819,7 +817,7 @@ object find_reason { ...@@ -819,7 +817,7 @@ object find_reason {
val old_count = sc.sql( val old_count = sc.sql(
s""" 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 |from device_id_old dio left join agency_id
|on dio.device_id = agency_id.device_id |on dio.device_id = agency_id.device_id
|where agency_id.device_id is null |where agency_id.device_id is null
...@@ -829,7 +827,7 @@ object find_reason { ...@@ -829,7 +827,7 @@ object find_reason {
//4.当天新用户数 //4.当天新用户数
val new_count = sc.sql( val new_count = sc.sql(
s""" 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 |from device_id_new din left join agency_id
|on din.device_id = agency_id.device_id |on din.device_id = agency_id.device_id
|where agency_id.device_id is null |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