Commit f9e80a83 authored by 王志伟's avatar 王志伟

彦钊的ctr增加尾号1的对照组

parent b35797f6
...@@ -119,10 +119,40 @@ object temp_count { ...@@ -119,10 +119,40 @@ object temp_count {
""".stripMargin """.stripMargin
) )
val clk_count_oldUser_Contrast = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as clk_count_oldUser_Contrast
|from data_feed_click jd inner join device_id_old
|on jd.device_id = device_id_old.device_id
|where (jd.cid_type = 'diary' or jd.cid_type = 'diary_video')
|and jd.device_id regexp'1$$'
|and jd.device_id not in (select device_id from blacklist)
|and jd.city_id in ("huzhou","liuan","zhenjiang","taizhou","jiaxing","weihai","maanshan","changzhou","shantou","nantong","yantai","wuxi","huhehaote","taiyuan","xining","yinchuan")
|and jd.stat_date ='${stat_date}'
""".stripMargin
)
val imp_count_oldUser_Contrast = sc.sql(
s"""
|select '${stat_date}' as stat_date, count(cid_id) as imp_count_oldUser_Contrast
|from data_feed_exposure 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.city_id in ("huzhou","liuan","zhenjiang","taizhou","jiaxing","weihai","maanshan","changzhou","shantou","nantong","yantai","wuxi","huhehaote","taiyuan","xining","yinchuan")
|and je.stat_date ='${stat_date}'
""".stripMargin
)
val result1 = clk_count_oldUser.join(imp_count_oldUser,"stat_date") val result1 = clk_count_oldUser.join(imp_count_oldUser,"stat_date")
.join(clk_count_all,"stat_date") .join(clk_count_all,"stat_date")
.join(imp_count__all,"stat_date") .join(imp_count__all,"stat_date")
.join(clk_count_oldUser_Contrast,"stat_date")
.join(imp_count_oldUser_Contrast,"stat_date")
result1.show() result1.show()
GmeiConfig.writeToJDBCTable(result1, "ffm_diary_ctr", SaveMode.Append) GmeiConfig.writeToJDBCTable(result1, "ffm_diary_ctr", SaveMode.Append)
......
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