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

修复bug

parent c7124681
...@@ -54,12 +54,12 @@ object testt { ...@@ -54,12 +54,12 @@ object testt {
val stat_date=param.date val stat_date=param.date
val partition_date = stat_date.replace("-","") val partition_date = stat_date.replace("-","")
//机构id //机构id
val black = sc.sql( val blacklist = sc.sql(
s""" s"""
|select device_id from blacklist |select device_id from blacklist
""".stripMargin """.stripMargin
) )
black.show() blacklist.createOrReplaceTempView("blacklist")
val agency_id = sc.sql( val agency_id = sc.sql(
s""" s"""
...@@ -119,7 +119,7 @@ object testt { ...@@ -119,7 +119,7 @@ object testt {
//日记本转化美购 //日记本转化美购
//1.日记本到美购转化数 //1.日记本到美购转化数
val diary_meigou_device = sc.sql( val diary_meigou_temp = sc.sql(
s""" s"""
|select ou.cl_id as device_id |select ou.cl_id as device_id
|from online.bl_hdfs_page_view_updates ou left join agency_id |from online.bl_hdfs_page_view_updates ou left join agency_id
...@@ -128,7 +128,15 @@ object testt { ...@@ -128,7 +128,15 @@ object testt {
|and ou.page_name='welfare_detail' |and ou.page_name='welfare_detail'
|and ou.referrer='diary_detail' |and ou.referrer='diary_detail'
|and agency_id.device_id is null |and agency_id.device_id is null
|and ou.cl_id not in (select device_id from blacklist) """.stripMargin
)
diary_meigou_temp.createOrReplaceTempView("diary_meigou_temp")
val diary_meigou_device = sc.sql(
s"""
|select device_id
|from diary_meigou_temp dt left join blacklist
|on dt.device_id = blacklist.device_id
|where blacklist.device_id is null
""".stripMargin """.stripMargin
) )
diary_meigou_device.createOrReplaceTempView("diary_meigou_device") diary_meigou_device.createOrReplaceTempView("diary_meigou_device")
...@@ -166,7 +174,7 @@ object testt { ...@@ -166,7 +174,7 @@ object testt {
// diary_meigou_count.show() // diary_meigou_count.show()
//2.日记本点击数 //2.日记本点击数
val diary_clk_device = sc.sql( val diary_clk_temp = sc.sql(
s""" s"""
|select ov.cl_id as device_id |select ov.cl_id as device_id
|from online.tl_hdfs_maidian_view ov left join agency_id |from online.tl_hdfs_maidian_view ov left join agency_id
...@@ -175,9 +183,19 @@ object testt { ...@@ -175,9 +183,19 @@ object testt {
|and ov.cl_id != "NULL" |and ov.cl_id != "NULL"
|and ov.partition_date='${partition_date}' |and ov.partition_date='${partition_date}'
|and agency_id.device_id is null |and agency_id.device_id is null
|and ov.cl_id not in (select device_id from blacklist)
""".stripMargin """.stripMargin
) )
diary_clk_temp.createOrReplaceTempView("diary_clk_temp")
val diary_clk_device = sc.sql(
s"""
|select device_id
|from diary_clk_temp dt left join blacklist
|on dt.device_id = blacklist.device_id
|where blacklist.device_id is null
""".stripMargin
)
diary_clk_device.createOrReplaceTempView("diary_clk_device") diary_clk_device.createOrReplaceTempView("diary_clk_device")
//新用户日记本点击 //新用户日记本点击
...@@ -213,7 +231,7 @@ object testt { ...@@ -213,7 +231,7 @@ object testt {
// diary_clk.show() // diary_clk.show()
//3.日记本曝光数 //3.日记本曝光数
val diary_expoure_device=sc.sql( val diary_expoure_temp=sc.sql(
s""" s"""
|select od.cl_id as device_id |select od.cl_id as device_id
|from online.ml_community_exposure_detail od left join agency_id |from online.ml_community_exposure_detail od left join agency_id
...@@ -222,9 +240,19 @@ object testt { ...@@ -222,9 +240,19 @@ object testt {
|and od.cl_id != "NULL" |and od.cl_id != "NULL"
|and od.partition_date='${partition_date}' |and od.partition_date='${partition_date}'
|and agency_id.device_id is null |and agency_id.device_id is null
|and od.cl_id not in (select device_id from blacklist)
""".stripMargin """.stripMargin
) )
diary_expoure_temp.createOrReplaceTempView("diary_expoure_temp")
val diary_expoure_device = sc.sql(
s"""
|select device_id
|from diary_expoure_temp dt left join blacklist
|on dt.device_id = blacklist.device_id
|where blacklist.device_id is null
""".stripMargin
)
diary_expoure_device.createOrReplaceTempView("diary_expoure_device") diary_expoure_device.createOrReplaceTempView("diary_expoure_device")
//新用户日记本曝光 //新用户日记本曝光
val diary_exp_newUser = sc.sql( val diary_exp_newUser = sc.sql(
...@@ -260,7 +288,7 @@ object testt { ...@@ -260,7 +288,7 @@ object testt {
// diary_expoure.show() // diary_expoure.show()
//4.搜索次数统计 //4.搜索次数统计
val search_device = sc.sql( val search_device_temp = sc.sql(
s""" s"""
|select ov.cl_id as device_id |select ov.cl_id as device_id
|from online.tl_hdfs_maidian_view ov left join agency_id |from online.tl_hdfs_maidian_view ov left join agency_id
...@@ -268,7 +296,16 @@ object testt { ...@@ -268,7 +296,16 @@ object testt {
|where (ov.action = 'do_search' or ov.action = 'search_result_click_search') |where (ov.action = 'do_search' or ov.action = 'search_result_click_search')
|and ov.partition_date ='${partition_date}' |and ov.partition_date ='${partition_date}'
|and agency_id.device_id is null |and agency_id.device_id is null
|and ov.cl_id not in (select device_id from blacklist) """.stripMargin
)
search_device_temp.createOrReplaceTempView("search_device_temp")
val search_device = sc.sql(
s"""
|select device_id
|from search_device_temp dt left join blacklist
|on dt.device_id = blacklist.device_id
|where blacklist.device_id is null
""".stripMargin """.stripMargin
) )
search_device.createOrReplaceTempView("search_device") search_device.createOrReplaceTempView("search_device")
...@@ -292,7 +329,7 @@ object testt { ...@@ -292,7 +329,7 @@ object testt {
) )
//5.登录人数 //5.登录人数
val log_device = sc.sql( val log_device_temp = sc.sql(
s""" s"""
|select distinct(oe.device_id) as log_device |select distinct(oe.device_id) as log_device
|from data_feed_exposure oe left join agency_id |from data_feed_exposure oe left join agency_id
...@@ -302,6 +339,16 @@ object testt { ...@@ -302,6 +339,16 @@ object testt {
|and oe.device_id not in (select device_id from blacklist) |and oe.device_id not in (select device_id from blacklist)
""".stripMargin """.stripMargin
) )
log_device_temp.createOrReplaceTempView("log_device_temp")
val log_device = sc.sql(
s"""
|select device_id
|from log_device_temp dt left join blacklist
|on dt.device_id = blacklist.device_id
|where blacklist.device_id is null
""".stripMargin
)
log_device.createOrReplaceTempView("log_device") log_device.createOrReplaceTempView("log_device")
//新用户登录人数 //新用户登录人数
......
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