-- ,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