Commit 7ac77265 authored by litaolemo's avatar litaolemo

update

parent 0d0f4e17
...@@ -154,32 +154,60 @@ print(huidu_device_id_sql) ...@@ -154,32 +154,60 @@ print(huidu_device_id_sql)
huidu_device_id_df = spark.sql(huidu_device_id_sql) huidu_device_id_df = spark.sql(huidu_device_id_sql)
huidu_device_id_df.createOrReplaceTempView("dev_view") huidu_device_id_df.createOrReplaceTempView("dev_view")
sql_search_ctr = r""" sql_search_ctr = r"""
SELECT SELECT card_name,count(card_name)
count(distinct (a.cl_id)) -- click.partition_date as partition_date
-- ,active_type
-- ,device_os_type
-- ,channel
-- ,count(click.cl_id) as all_search_click_pv_724
-- ,count(distinct click.cl_id) as all_search_click_uv_724
FROM FROM
(select device_id from dev_view) t1 left join
( (
SELECT SELECT cl_id,partition_date,action,params['page_name'] as page_name,'' as input_type,app_version,params['card_name'] as card_name
cl_id, FROM online.bl_hdfs_maidian_updates
card_id, WHERE partition_date >= '{start_date}'
app_session_id, AND partition_date < '{end_date}'
transaction_type AND action = 'on_click_navbar_search'
from online.ml_community_precise_exposure_detail AND (int(split(app_version,'\\.')[0]) = 7 AND int(split(app_version,'\\.')[1]) >= 24)
WHERE partition_date>= '${today_str}'
AND action in ('page_precise_exposure','home_choiceness_card_exposure') --7745版本action改为page_precise_exposure UNION all
AND is_exposure = '1' ----精准曝光 SELECT cl_id,partition_date,action,params['page_name'] as page_name,params['input_type'] as input_type,app_version,params['card_name'] as card_name
AND page_name ='home' FROM online.bl_hdfs_maidian_updates
AND tab_name = '精选' WHERE partition_date >= '{start_date}'
AND (transaction_type in ('-1','smr','hotspot','pgc','newdata','hotspot_feed','aistragegy','excestragegy','FIXEDSTRATEGY','FIXEDSTRATEGY_VIDEO','high_quality_fmctr') AND partition_date < '{end_date}'
or transaction_type like '%ctr' or transaction_type like '%cvr' or transaction_type like 'deeplink%') AND action = 'do_search'
AND card_content_type in ('user_post') AND params['input_type'] = '详情页默认词'
group by
cl_id, union all
transaction_type, SELECT cl_id,partition_date,action,'home' as page_name,'首页-猜你喜欢' as input_type,app_version,params['card_name'] as card_name
card_id, FROM online.bl_hdfs_maidian_updates
app_session_id WHERE partition_date >= '{start_date}'
)a on t1.device_id = a.cl_id AND partition_date < '{end_date}'
""".format(today_str='20200926') AND action = 'on_click_card'
AND params['in_page_pos']='猜你喜欢'
AND params['tab_name']='精选'
AND params['card_type']='search_word'
--AND page_name='home' android的page_name为空
union all
SELECT cl_id,partition_date,action,params['page_name'] as page_name,'美购首页-大家都在搜' as input_type,app_version,params['card_name'] as card_name
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= '{start_date}'
AND partition_date < '{end_date}'
AND action = 'on_click_card'
AND params['page_name']='welfare_home'
AND params['card_type'] ='search_word'
AND params['in_page_pos']='大家都在搜'
union all
SELECT cl_id,partition_date,action,params['page_name'] as page_name,'高亮词' as input_type,app_version,params['card_name'] as card_name
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= '{start_date}'
AND partition_date < '{end_date}'
AND action = 'on_click_card'
AND params['card_type'] ='highlight_word'
) group by card_name
""".format(start_date='20201024',partition_date='20201025')
print(sql_search_ctr) print(sql_search_ctr)
search_ctr_df = spark.sql(sql_search_ctr) search_ctr_df = spark.sql(sql_search_ctr)
......
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