Commit db87889b authored by litaolemo's avatar litaolemo

update

parent 53b3f97e
...@@ -73,7 +73,7 @@ spark.sql("CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJso ...@@ -73,7 +73,7 @@ spark.sql("CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJso
spark.sql("CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDFArryMerge'") spark.sql("CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDFArryMerge'")
task_list = [] task_list = []
task_days = 60 task_days = 3
for t in range(1, task_days): for t in range(1, task_days):
day_num = 0 - t day_num = 0 - t
now = (datetime.datetime.now() + datetime.timedelta(days=day_num)) now = (datetime.datetime.now() + datetime.timedelta(days=day_num))
...@@ -116,6 +116,17 @@ for t in range(1, task_days): ...@@ -116,6 +116,17 @@ for t in range(1, task_days):
)a )a
group by partition_day,card_content_type,device_id group by partition_day,card_content_type,device_id
)t1 )t1
left join
(
SELECT DISTINCT device_id
FROM ml.ml_d_ct_dv_devicespam_d --去除机构刷单设备,即作弊设备(浏览和曝光事件去除)
WHERE partition_day='{partition_day}'
UNION ALL
SELECT DISTINCT device_id
FROM dim.dim_device_user_staff --去除内网用户
)spam_pv
on spam_pv.device_id=t1.device_id
LEFT JOIN LEFT JOIN
( (
SELECT partition_date,device_id SELECT partition_date,device_id
...@@ -245,7 +256,7 @@ for t in range(1, task_days): ...@@ -245,7 +256,7 @@ for t in range(1, task_days):
partition_date = yesterday_str partition_date = yesterday_str
pid = hashlib.md5((partition_date + device_os_type + active_type).encode("utf8")).hexdigest() pid = hashlib.md5((partition_date + device_os_type + active_type).encode("utf8")).hexdigest()
click_num = res.neirong_click_pv click_num = res.neirong_click_pv
exposure = res.neirong_exp_pv exposure = res.exposure
try: try:
search_ctr = round(click_num / exposure, 5) search_ctr = round(click_num / exposure, 5)
except: except:
......
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