Commit d9d98a28 authored by litaolemo's avatar litaolemo

update

parent 46b65c43
...@@ -68,7 +68,7 @@ for t in range(0, task_days): ...@@ -68,7 +68,7 @@ for t in range(0, task_days):
last_30_day_str = (now + datetime.timedelta(days=-30)).strftime("%Y%m%d") last_30_day_str = (now + datetime.timedelta(days=-30)).strftime("%Y%m%d")
today_str = now.strftime("%Y%m%d") today_str = now.strftime("%Y%m%d")
yesterday_str = (now + datetime.timedelta(days=-1)).strftime("%Y%m%d") yesterday_str = (now + datetime.timedelta(days=-1)).strftime("%Y%m%d")
one_week_age_str = (now + datetime.timedelta(days=-90)).strftime("%Y%m%d") one_week_age_str = (now + datetime.timedelta(days=-7)).strftime("%Y%m%d")
sql = """ sql = """
SELECT SELECT
partition_date partition_date
...@@ -103,20 +103,20 @@ FROM ...@@ -103,20 +103,20 @@ FROM
,coalesce(t1.device_os_type,t2.device_os_type,t3.device_os_type,t4.device_os_type,t5.device_os_type,t6.device_os_type) as device_os_type ,coalesce(t1.device_os_type,t2.device_os_type,t3.device_os_type,t4.device_os_type,t5.device_os_type,t6.device_os_type) as device_os_type
,coalesce(t1.channel,t2.channel,t3.channel,t4.channel,t5.channel,t6.channel) as channel ,coalesce(t1.channel,t2.channel,t3.channel,t4.channel,t5.channel,t6.channel) as channel
,coalesce(t1.dau,0) as dau ,coalesce(t1.dau,0) as dau
,coalesce(t3.all_search_uv,0) as all_search_uv ,coalesce(t3.all_search_uv,0) as all_search_uv
,coalesce(t3.all_search_pv,0) as all_search_pv ,coalesce(t3.all_search_pv,0) as all_search_pv
,coalesce(t4.search_home_uv,0) as search_home_uv ,coalesce(t4.search_home_uv,0) as search_home_uv
,coalesce(t4.search_home_pv,0) as search_home_pv ,coalesce(t4.search_home_pv,0) as search_home_pv
,coalesce(t3.sug_search_uv_726,0) as sug_search_uv_726 ,coalesce(t3.sug_search_uv_726,0) as sug_search_uv_726
,coalesce(t3.sug_search_pv_726,0) as sug_search_pv_726 ,coalesce(t3.sug_search_pv_726,0) as sug_search_pv_726
,coalesce(t2.all_search_click_uv_724,0) as all_search_click_uv_724 ,coalesce(t2.all_search_click_uv_724,0) as all_search_click_uv_724
,coalesce(t2.all_search_click_pv_724,0) as all_search_click_pv_724 ,coalesce(t2.all_search_click_pv_724,0) as all_search_click_pv_724
,coalesce(t4.referrer_search_hexin_pv,0) as referrer_search_hexin_pv ,coalesce(t4.referrer_search_hexin_pv,0) as referrer_search_hexin_pv
,coalesce(t4.referrer_search_welfare_pv,0) as referrer_search_welfare_pv ,coalesce(t4.referrer_search_welfare_pv,0) as referrer_search_welfare_pv
,coalesce(t4.referrer_search_neirong_pv,0) as referrer_search_neirong_pv ,coalesce(t4.referrer_search_neirong_pv,0) as referrer_search_neirong_pv
,coalesce(t5.search_hexin_two_pv,0) as search_hexin_two_pv ,coalesce(t5.search_hexin_two_pv,0) as search_hexin_two_pv
,coalesce(t5.search_neirong_two_pv,0) as search_neirong_two_pv ,coalesce(t5.search_neirong_two_pv,0) as search_neirong_two_pv
,coalesce(t4.referrer_search_neirong_uv_1000,0) as referrer_search_neirong_uv_1000 ,coalesce(t4.referrer_search_neirong_uv_1000,0) as referrer_search_neirong_uv_1000
,coalesce(t4.referrer_search_neirong_pagestay,0) as referrer_search_neirong_pagestay ,coalesce(t4.referrer_search_neirong_pagestay,0) as referrer_search_neirong_pagestay
,coalesce(t6.sug_out_uv_726,0) as sug_out_uv_726 ,coalesce(t6.sug_out_uv_726,0) as sug_out_uv_726
,coalesce(t6.sug_out_pv_726,0) as sug_out_pv_726 ,coalesce(t6.sug_out_pv_726,0) as sug_out_pv_726
...@@ -395,7 +395,7 @@ FROM ...@@ -395,7 +395,7 @@ FROM
AND t4.device_os_type = t1.device_os_type AND t4.device_os_type = t1.device_os_type
AND t4.channel = t1.channel AND t4.channel = t1.channel
full JOIN full JOIN
( (
SELECT SELECT
card_click.partition_date as partition_date card_click.partition_date as partition_date
,active_type ,active_type
...@@ -535,7 +535,6 @@ FROM ...@@ -535,7 +535,6 @@ FROM
AND t6.device_os_type = t1.device_os_type AND t6.device_os_type = t1.device_os_type
AND t6.channel = t1.channel AND t6.channel = t1.channel
)t )t
""".format(start_date=one_week_age_str, end_date=today_str, ) """.format(start_date=one_week_age_str, end_date=today_str, )
device_df = spark.sql(sql) device_df = spark.sql(sql)
......
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