Commit 04f6a46e authored by 王志伟's avatar 王志伟

统计新指标,device_clk_imp_reason

parent e1dd8216
......@@ -784,9 +784,8 @@ object find_reason {
val old_clk_device = sc.sql(
s"""
|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 inner join device_id_old
|on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
""".stripMargin
)
old_clk_device.createOrReplaceTempView("old_clk_device")
......@@ -796,10 +795,9 @@ object find_reason {
//2.当天新用户中的点击用户数
val new_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_new
|select '${stat_date}' as stat_date,count(oc.device_id) as new_clk_count
|from all_clk_diary_card oc inner join device_id_new
|on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null
|group by stat_date
""".stripMargin
)
......@@ -807,9 +805,8 @@ object find_reason {
val new_clk_device = sc.sql(
s"""
|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 inner join device_id_new
|on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null
""".stripMargin
)
new_clk_device.createOrReplaceTempView("new_clk_device")
......@@ -820,9 +817,8 @@ object find_reason {
val old_count = sc.sql(
s"""
|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 inner join agency_id
|on dio.device_id = agency_id.device_id
|where agency_id.device_id is null
""".stripMargin
)
......@@ -830,29 +826,30 @@ object find_reason {
val new_count = sc.sql(
s"""
|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 inner join agency_id
|on din.device_id = agency_id.device_id
|where agency_id.device_id is null
""".stripMargin
)
//5.有点击老用户的曝光数
val exp_clkold_count = sc.sql(
s"""
|select '${stat_date}' as stat_date,count(din.device_id) as imp_clkold_count
|from data_feed_exposure_precise dp left join old_clk_device
|select '${stat_date}' as stat_date,count(dp.device_id) as imp_clkold_count
|from data_feed_exposure_precise dp inner join old_clk_device
|on dp.device_id = old_clk_device.device_id
|where old_clk_device.device_id is not null
|where stat_date='${stat_date}'
|group by stat_date
""".stripMargin
)
//6.有点击新用户的曝光数
val exp_clknew_count = sc.sql(
s"""
|select '${stat_date}' as stat_date,count(din.device_id) as imp_clknew_count
|from data_feed_exposure_precise dp left join new_clk_device
|select '${stat_date}' as stat_date,count(dp.device_id) as imp_clknew_count
|from data_feed_exposure_precise dp inner join new_clk_device
|on dp.device_id = new_clk_device.device_id
|where new_clk_device.device_id is not null
|where stat_date='${stat_date}'
|group by stat_date
""".stripMargin
)
......
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