AND (card_content_type IN ('diary') or card_type = 'diary')
) mas
)a
LATERAL VIEW explode(mas.channel) t2 AS channel
group by partition_day,card_content_type,device_id
LATERAL VIEW explode(mas.device_os_type) t2 AS device_os_type
)t1
LATERAL VIEW explode(mas.active_type) t2 AS active_type
)t1
LEFT JOIN
left JOIN
(--搜索结果页卡片点击
(--搜索结果页卡片精准曝光
SELECT cl_id,partition_date
SELECT device_id,concat_ws('-',substr(partition_day,1,4),substr(partition_day,5,2),substr(partition_day,7,2)) as partition_date
,sum(CASE WHEN card_content_type='service' THEN click_pv END) as service_click_pv
,count(distinct CASE WHEN page_code='search_result_diary' THEN array(card_id,app_session_id) END) as diary_exp_pv
,sum(CASE WHEN card_content_type='neirong' THEN click_pv END) as neirong_click_pv
,count(CASE WHEN page_code='search_result_question_answer' THEN array(card_id,app_session_id) END) as qa_exp_pv
FROM
FROM ml.mid_ml_c_et_pe_preciseexposure_dimen_d
(
WHERE partition_day ="{today_str}"
SELECT partition_date,cl_id,'service' as card_content_type,count(1) as click_pv
and action in ('page_precise_exposure','home_choiceness_card_exposure')
FROM online.bl_hdfs_maidian_updates
and is_exposure = '1'
WHERE partition_date >= '{partition_day}'
and page_code in ('search_result_diary','search_result_question_answer')
AND partition_date < '{end_date}'
AND card_content_type IN ('answer','diary','user_post','doctor_post','question','qa')
AND ((action in ('search_result_click_recommend_item','search_result_welfare_click_item')
group by partition_day,device_id
AND page_name in ('search_result_more','search_result_welfare'))
)t6
or (action = 'goto_welfare_detail' AND params ['from'] = 'search_result_welfare_recommend')
on t1.partition_date=t6.partition_date and t1.device_id=t6.device_id
or (action = 'on_click_card' AND params['card_content_type'] in ('service') AND page_name in ('search_result_more','search_result_welfare')))
LEFT JOIN
GROUP BY partition_date,cl_id,'service'
(--搜索结果页卡片点击
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date,cl_id
UNION ALL
,count(distinct CASE WHEN page_name='search_result_diary' THEN array(params['card_id'],app_session_id) END) as diary_click_pv
SELECT partition_date,cl_id,'neirong' as card_content_type,count(1) as click_pv
,count(distinct CASE WHEN page_name='search_result_question_answer' THEN array(params['card_id'],app_session_id) END) as qa_click_pv
FROM online.bl_hdfs_maidian_updates
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= '{partition_day}'
WHERE partition_date ="{today_str}"
AND partition_date < '{end_date}'
AND action = 'on_click_card'
AND ((action in ('on_click_topic_card','on_click_diary_card','search_result_click_infomation_item')
AND params['card_content_type'] in ('answer','diary','question','qa')
AND page_name in ('search_result_more','search_result_diary','search_result_post'))
AND page_name in ('search_result_diary','search_result_question_answer')
or (action = 'on_click_card' AND params['card_content_type'] in ('answer','diary') AND page_name in ('search_result_more','search_result_diary','search_result_question_answer')))
GROUP BY cl_id,partition_date
GROUP BY partition_date,cl_id,'neirong'
)t7
)t2
on t6.partition_date=t7.partition_date and t6.device_id=t7.cl_id
GROUP BY cl_id,partition_date
)t2
left join
ON t1.partition_day=t2.partition_date AND t1.device_id=t2.cl_id