SELECT NVL(t2.partition_date,t3.partition_date) as partition_date
,NVL(t2.cl_id,t3.cl_id) as cl_id
,NVL(t2.query,t3.query) as query
,NVL(t2.pv,0) as hexin
,NVL(t3.pv,0) as neirong
FROM
(
SELECT partition_date
,params['query'] as query
,cl_id
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= {last_30_day_str}
AND partition_date < {today_str}
AND ((action in ('search_result_click_recommend_item','search_result_welfare_click_item','search_result_hospital_click_item','search_result_doctor_click_item','on_click_doctor_card', 'on_click_hospital_card')
AND page_name in ('search_result_more','search_result_welfare','search_result_hospital','search_result_doctor'))
or (action = 'goto_welfare_detail' AND params [ 'from' ] = 'search_result_welfare_recommend')
or (action = 'on_click_card' AND params['card_content_type'] in ('service','hospital','doctor') AND page_name in ('search_result_more','search_result_welfare','search_result_hospital','search_result_doctor'))
or (action = 'on_click_button' AND params['button_name'] = 'check_plan' AND page_name = 'search_result_more'))
GROUP BY partition_date
,params['query']
,cl_id
)t2
FULL JOIN
(
SELECT partition_date
,params['query'] as query
,cl_id
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= {last_30_day_str}
AND partition_date < {today_str}
AND ((action in ('on_click_topic_card','on_click_diary_card','search_result_click_infomation_item')
AND page_name in ('search_result_more','search_result_diary','search_result_post'))
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')))
SELECT NVL(t2.partition_date,t3.partition_date) as partition_date
,NVL(t2.cl_id,t3.cl_id) as cl_id
,NVL(t2.query,t3.query) as query
,NVL(t2.pv,0) as hexin
,NVL(t3.pv,0) as neirong
FROM
(
SELECT partition_date
,params['query'] as query
,cl_id
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= {one_week_age_str}
AND partition_date < {today_str}
AND ((action in ('search_result_click_recommend_item','search_result_welfare_click_item','search_result_hospital_click_item','search_result_doctor_click_item','on_click_doctor_card', 'on_click_hospital_card')
AND page_name in ('search_result_more','search_result_welfare','search_result_hospital','search_result_doctor'))
or (action = 'goto_welfare_detail' AND params [ 'from' ] = 'search_result_welfare_recommend')
or (action = 'on_click_card' AND params['card_content_type'] in ('service','hospital','doctor') AND page_name in ('search_result_more','search_result_welfare','search_result_hospital','search_result_doctor'))
or (action = 'on_click_button' AND params['button_name'] = 'check_plan' AND page_name = 'search_result_more'))
GROUP BY partition_date
,params['query']
,cl_id
)t2
FULL JOIN
(
SELECT partition_date
,params['query'] as query
,cl_id
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= {one_week_age_str}
AND partition_date < {today_str}
AND ((action in ('on_click_topic_card','on_click_diary_card','search_result_click_infomation_item')
AND page_name in ('search_result_more','search_result_diary','search_result_post'))
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')))