SELECT NVL(t2.partition_date,t3.partition_date) as partition_date
SELECT NVL(t2.partition_date,t3.partition_date) as partition_date
,NVL(t2.cl_id,t3.cl_id) as cl_id
,NVL(t2.cl_id,t3.cl_id) as cl_id
,NVL(t2.query,t3.query) as query
,NVL(t2.pv,0) as hexin
,NVL(t2.pv,0) as hexin
,NVL(t3.pv,0) as neirong
,NVL(t3.pv,0) as neirong
FROM
FROM
(
(
SELECT partition_date
SELECT partition_date
,params['query'] as query
,cl_id
,cl_id
,count(1) as pv
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
FROM online.bl_hdfs_maidian_updates
...
@@ -266,13 +261,11 @@ for t in range(0, task_days):
...
@@ -266,13 +261,11 @@ for t in range(0, task_days):
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_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'))
or (action = 'on_click_button' AND params['button_name'] = 'check_plan' AND page_name = 'search_result_more'))
GROUP BY partition_date
GROUP BY partition_date
,params['query']
,cl_id
,cl_id
)t2
)t2
FULL JOIN
FULL JOIN
(
(
SELECT partition_date
SELECT partition_date
,params['query'] as query
,cl_id
,cl_id
,count(1) as pv
,count(1) as pv
FROM online.bl_hdfs_maidian_updates
FROM online.bl_hdfs_maidian_updates
...
@@ -282,11 +275,9 @@ for t in range(0, task_days):
...
@@ -282,11 +275,9 @@ for t in range(0, task_days):
AND page_name in ('search_result_more','search_result_diary','search_result_post'))
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')))
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 partition_date
GROUP BY partition_date
,params['query']
,cl_id
,cl_id
)t3
)t3
on t3.partition_date=t2.partition_date
on t3.partition_date=t2.partition_date
AND t3.query=t2.query
AND t3.cl_id=t2.cl_id
AND t3.cl_id=t2.cl_id
)t1
)t1
JOIN
JOIN
...
@@ -316,9 +307,9 @@ for t in range(0, task_days):
...
@@ -316,9 +307,9 @@ for t in range(0, task_days):
LATERAL VIEW explode(mas.active_type) t2 AS active_type
LATERAL VIEW explode(mas.active_type) t2 AS active_type
)dev
)dev
on t1.cl_id=dev.device_id and t1.partition_date = dev.partition_date
on t1.cl_id=dev.device_id and t1.partition_date = dev.partition_date
GROUP BY t1.query,active_type,device_os_type,channel
GROUP BY active_type,device_os_type,channel
)t4
)t4
on t3.query=t4.query and t3.active_type=t4.active_type and t3.device_os_type = t4.device_os_type AND t3.channel = t4.channel group by t3.active_type , t3.device_os_type ,t3.channel
on t3.active_type=t4.active_type and t3.device_os_type = t4.device_os_type AND t3.channel = t4.channel group by t3.active_type , t3.device_os_type ,t3.channel