Commit ebfd7765 authored by 张彦钊's avatar 张彦钊

Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline

change sql
parents 60bc2bf8 eb0339ca
...@@ -545,6 +545,19 @@ object diary_clk_card { ...@@ -545,6 +545,19 @@ object diary_clk_card {
""".stripMargin """.stripMargin
) )
val imp_count_oldUser_Contrast_precise = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as imp_count_oldUser_Contrast_precise
|from data_feed_exposure_precise je inner join device_id_old
|on je.device_id = device_id_old.device_id
|where je.cid_type = 'diary'
|and je.device_id regexp'1$$'
|and je.device_id not in (select device_id from blacklist)
|and je.stat_date ='${stat_date}'
""".stripMargin
)
val clk_count_oldUser_all_a = sc.sql( val clk_count_oldUser_all_a = sc.sql(
s""" s"""
|select '${stat_date}' as stat_date, count(ot.cl_id) as clk_count_oldUser_all_a |select '${stat_date}' as stat_date, count(ot.cl_id) as clk_count_oldUser_all_a
...@@ -581,6 +594,17 @@ object diary_clk_card { ...@@ -581,6 +594,17 @@ object diary_clk_card {
""".stripMargin """.stripMargin
) )
val imp_count_oldUser_all_precise = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as imp_count_oldUser_all_precise
|from data_feed_exposure_precise je inner join device_id_old
|on je.device_id = device_id_old.device_id
|where je.cid_type = 'diary'
|and je.device_id not in (select device_id from blacklist)
|and je.stat_date ='${stat_date}'
""".stripMargin
)
//统计新用户ctr //统计新用户ctr
val device_id_newUser = sc.sql( val device_id_newUser = sc.sql(
s""" s"""
...@@ -640,6 +664,18 @@ object diary_clk_card { ...@@ -640,6 +664,18 @@ object diary_clk_card {
""".stripMargin """.stripMargin
) )
val imp_count_newUser_Contrast_precise = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as imp_count_newUser_Contrast_precise
|from data_feed_exposure_precise je inner join device_id_new
|on je.device_id = device_id_new.device_id
|where je.cid_type = 'diary'
|and je.device_id regexp'1$$'
|and je.device_id not in (select device_id from blacklist)
|and je.stat_date ='${stat_date}'
""".stripMargin
)
val clk_count_newUser_all_a = sc.sql( val clk_count_newUser_all_a = sc.sql(
s""" s"""
...@@ -677,6 +713,17 @@ object diary_clk_card { ...@@ -677,6 +713,17 @@ object diary_clk_card {
""".stripMargin """.stripMargin
) )
val imp_count_newUser_all_precise = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as imp_count_newUser_all_precise
|from data_feed_exposure_precise je inner join device_id_new
|on je.device_id = device_id_new.device_id
|where je.cid_type = 'diary'
|and je.device_id not in (select device_id from blacklist)
|and je.stat_date ='${stat_date}'
""".stripMargin
)
val result1 = clk_count_oldUser_Contrast_a.join(clk_count_oldUser_Contrast_b,"stat_date") val result1 = clk_count_oldUser_Contrast_a.join(clk_count_oldUser_Contrast_b,"stat_date")
.join(imp_count_oldUser_Contrast,"stat_date") .join(imp_count_oldUser_Contrast,"stat_date")
...@@ -700,10 +747,3 @@ object diary_clk_card { ...@@ -700,10 +747,3 @@ object diary_clk_card {
} }
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