Commit 3450d401 authored by 赵建伟's avatar 赵建伟

update codes

parent fb92acfc
SET mapreduce.job.queuename = data; SET mapreduce.job.queuename=data;
SET mapreduce.map.memory.mb = 8192; SET mapreduce.map.memory.mb=8192;
SET mapreduce.map.java.opts = -Xmx8000m; SET mapreduce.map.java.opts=-Xmx8000m;
SET mapreduce.reduce.memory.mb = 8192; SET mapreduce.reduce.memory.mb=8192;
SET mapreduce.reduce.java.opts = -Xmx8000m; SET mapreduce.reduce.java.opts=-Xmx8000m;
set hive.auto.convert.join = true; set hive.auto.convert.join=true;
SET mapred.reduce.tasks = 20; SET mapred.reduce.tasks=20;
SET role admin; SET role admin;
INSERT OVERWRITE TABLE pm.tl_pm_search_click_path_d PARTITION (PARTITION_DAY = ${partition_day}) INSERT OVERWRITE TABLE pm.tl_pm_search_click_path_d PARTITION (PARTITION_DAY = ${partition_day})
SELECT day_id as day_id SELECT day_id as day_id
, device_os_type as device_os_type ,device_os_type as device_os_type
, active_type as active_type ,active_type as active_type
, v.search_entrance as search_entrance ,v.search_entrance as search_entrance
, sum(search_pv) as click_search_pv ,sum(search_pv) as click_search_pv
, sum(search_uv) as click_search_uv ,sum(search_uv) as click_search_uv
FROM ( FROM
SELECT day_id (
, device_os_type SELECT day_id,device_os_type,active_type,array(search_entrance,'合计') as search_entrance
, active_type ,search_pv,search_uv
, array(search_entrance, ''合计'') as search_entrance FROM
, search_pv (
, search_uv SELECT t1.partition_date as day_id
FROM ( ,t1.device_os_type
SELECT t1.partition_date as day_id ,t1.active_type
, t1.device_os_type ,case when action='on_click_navbar_search' and page_name='home' then '首页搜索框'
, t1.active_type when action='on_click_navbar_search' and page_name='welfare_home' then '美购首页搜索框'
, case when action = ''on_click_navbar_search'' and page_name = '' home '' then ''首页搜索框'' when action='on_click_navbar_search' and page_name='category' then '品类聚合页搜索框'
when action=''on_click_navbar_search'' and page_name=''welfare_home'' then ''美购首页搜索框'' when action='on_click_navbar_search' and page_name='welfare_list' and referrer_link ='["home","category"]' then '来自品类聚合的美购列表页搜索框'
when action=''on_click_navbar_search'' and page_name=''category'' then ''品类聚合页搜索框'' when action='on_click_navbar_search' and page_name='welfare_list' and referrer_link ='["welfare_home"]' then '来自美购首页的美购列表页搜索框'
when action=''on_click_navbar_search'' and page_name=''welfare_list'' and referrer_link =''["home","category"]'' then ''来自品类聚合的美购列表页搜索框'' when action in ('do_search','on_click_navbar_search')
when action=''on_click_navbar_search'' and page_name=''welfare_list'' and referrer_link =''["welfare_home"]'' then ''来自美购首页的美购列表页搜索框'' and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail'
when action in (''do_search'',''on_click_navbar_search'') ,'doctor_post_detail','question_detail','answer_detail','question_answer_detail') then '内容详情页搜索框'
and page_name in (''diary_detail'',''topic_detail'',''post_detail'',''user_post_detail'' when action ='详情页高亮词' then '详情页高亮词搜索'
,''doctor_post_detail'',''question_detail'',''answer_detail'',''question_answer_detail'') then ''内容详情页搜索框'' when action='大家都在看' then '首页feed大家都在看'
when action =''详情页高亮词'' then ''详情页高亮词搜索'' when action='热搜词' then '美购首页热搜词' else null end as search_entrance
when action=''大家都在看'' then ''首页feed大家都在看'' ,count(cl_id) as search_pv
when action=''热搜词'' then ''美购首页热搜词'' else null end as search_entrance ,count(distinct cl_id) as search_uv
,count(cl_id) as search_pv FROM
,count(distinct cl_id) as search_uv (
FROM SELECT partition_date,device_os_type
( ,case WHEN active_type = '4' THEN '老活跃设备'
SELECT partition_date, device_os_type WHEN active_type in ('1','2') then '新增设备' END as active_type
, case WHEN active_type = ''4'' THEN '' 老活跃设备 '' ,device_id
WHEN active_type in (''1'', ''2'') then '' 新增设备 '' END as active_type FROM online.ml_device_day_active_status
, device_id where partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
FROM online.ml_device_day_active_status AND active_type in ('1','2','4')
where partition_date = regexp_replace(DATE_SUB(current_date, 1), ''-'', '''') and first_channel_source_type not in ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3'
AND active_type in (''1'', ''2'', ''4'') ,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang'
and first_channel_source_type not in ('' yqxiu1 '', '' yqxiu2 '', '' yqxiu3 '', '' yqxiu4 '', '' yqxiu5 '', '' mxyc1 '', '' mxyc2 '', '' mxyc3 '' ,'js-az1','js-az2','js-az3','js-az4','js-az5','jfq-az1','jfq-az2','jfq-az3','jfq-az4','jfq-az5','toufang1'
, '' wanpu '', '' jinshan '', '' jx '', '' maimai '', '' zhuoyi '', '' huatian '', '' suopingjingling '', '' mocha '', '' mizhe '', '' meika '', '' lamabang '' ,'toufang2','toufang3','toufang4','toufang5','toufang6','TF-toufang1','TF-toufang2','TF-toufang3','TF-toufang4'
, '' js-az1 '', '' js-az2 '', '' js-az3 '', '' js-az4 '', '' js-az5 '', '' jfq-az1 '', '' jfq-az2 '', '' jfq-az3 '', '' jfq-az4 '', '' jfq-az5 '', '' toufang1 '' ,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100'
, '' toufang2 '', '' toufang3 '', '' toufang4 '', '' toufang5 '', '' toufang6 '', '' TF-toufang1 '', '' TF-toufang2 '', '' TF-toufang3 '', '' TF-toufang4 '' ,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ'
, '' TF-toufang5 '', '' tf-toufang1 '', '' tf-toufang2 '', '' tf-toufang3 '', '' tf-toufang4 '', '' tf-toufang5 '', '' benzhan '', '' promotion_aso100 '' ,'promotion_shike','promotion_julang_jl03','promotion_zuimei')
, '' promotion_qianka '', '' promotion_xiaoyu '', '' promotion_dianru '', '' promotion_malioaso '', '' promotion_malioaso-shequ '' AND first_channel_source_type not like 'promotion\_jf\_%'
, '' promotion_shike '', '' promotion_julang_jl03 '', '' promotion_zuimei '') )t1
AND first_channel_source_type not like '' promotion\_jf\_%'' join
) t1 (
join SELECT partition_date,cl_id,page_name,action,params['referrer_link'] as referrer_link
( FROM online.bl_hdfs_maidian_updates
SELECT partition_date, cl_id, page_name, action, params['' referrer_link ''] as referrer_link where partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
FROM online.bl_hdfs_maidian_updates and action in ('do_search','on_click_navbar_search')
where partition_date = regexp_replace(DATE_SUB(current_date, 1), ''-'', '''')
and action in ('' do_search '', '' on_click_navbar_search '') union all
union all
SELECT partition_date, cl_id, null as page_name, '' 大家都在看 '' as action, null as referrer_link SELECT partition_date,cl_id,null as page_name,'大家都���看' as action, null as referrer_link
FROM online.bl_hdfs_maidian_updates FROM online.bl_hdfs_maidian_updates
where partition_date = regexp_replace(DATE_SUB(current_date, 1), ''-'', '''') where partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action = '' on_click_card '' AND action = 'on_click_card'
AND params['' in_page_pos '']='' 猜你喜欢 '' AND params['in_page_pos']='猜你喜欢'
AND params['' tab_name '']='' 精选 '' AND params['tab_name']='精选'
AND params['' card_type '']='' search_word '' AND params['card_type']='search_word'
-- AND page_name='' home '' android的page_name为空 --AND page_name='home' android的page_name为空
union all
SELECT partition_date, cl_id, page_name, '' 热搜词 '' as action, null as referrer_link union all
FROM online.bl_hdfs_maidian_updates
where partition_date = regexp_replace(DATE_SUB(current_date, 1), ''-'', '''') SELECT partition_date,cl_id,page_name,'热搜词' as action, null as referrer_link
AND action = '' on_click_card '' FROM online.bl_hdfs_maidian_updates
AND page_name='' welfare_home '' where partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND params['' card_type ''] ='' search_word '' AND action = 'on_click_card'
AND params['' in_page_pos '']='' 大家都在搜 '' AND page_name='welfare_home'
union all AND params['card_type'] ='search_word'
select partition_date, cl_id, null as page_name, '' 详情页高亮词 '' as action, null as referrer_link AND params['in_page_pos']='大家都在搜'
from online.bl_hdfs_maidian_updates
where partition_date = regexp_replace(DATE_SUB(current_date, 1), ''-'', '''') union all
and action ='' on_click_card ''
and params['' card_type '']='' highlight_word '' select partition_date,cl_id,null as page_name,'详情页高亮词' as action,null as referrer_link
) t2 from online.bl_hdfs_maidian_updates
on t1.partition_date=t2.partition_date and t1.device_id=t2.cl_id where partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
group by t1.partition_date and action='on_click_card'
, t1.device_os_type and params['card_type']='highlight_word'
, t1.active_type )t2
, case when action ='' on_click_navbar_search '' and page_name='' home '' then '' 首页搜索框 '' on t1.partition_date=t2.partition_date and t1.device_id=t2.cl_id
when action ='' on_click_navbar_search '' and page_name='' welfare_home '' then '' 美购首页搜索框 '' group by t1.partition_date
when action ='' on_click_navbar_search '' and page_name='' category '' then '' 品类聚合页搜索框 '' ,t1.device_os_type
when action ='' on_click_navbar_search '' and page_name='' welfare_list '' and referrer_link =''["home", "category"]'' then '' 来自品类聚合的美购列表页搜索框 '' ,t1.active_type
when action ='' on_click_navbar_search '' and page_name='' welfare_list '' and referrer_link =''["welfare_home"]'' then '' 来自美购首页的美购列表页搜索框 '' ,case when action='on_click_navbar_search' and page_name='home' then '首页搜索框'
when action in ('' do_search '', '' on_click_navbar_search '') when action='on_click_navbar_search' and page_name='welfare_home' then '美购首页搜索框'
and page_name in ('' diary_detail '', '' topic_detail '', '' post_detail '', '' user_post_detail '' when action='on_click_navbar_search' and page_name='category' then '品类聚合页搜索框'
, '' doctor_post_detail '', '' question_detail '', '' answer_detail '', '' question_answer_detail '') then '' 内容详情页搜索框 '' when action='on_click_navbar_search' and page_name='welfare_list' and referrer_link ='["home","category"]' then '来自品类聚合的美购列表页搜索框'
when action ='' 详情页高亮词 '' then '' 详情页高亮词搜索 '' when action='on_click_navbar_search' and page_name='welfare_list' and referrer_link ='["welfare_home"]' then '来自美购首页的美购列表页搜索框'
when action ='' 大家都在看 '' then '' 首页feed大家都在看 '' when action in ('do_search','on_click_navbar_search')
when action ='' 热搜词 '' then '' 美购首页热搜词 '' else null end and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail'
having search_entrance is not null ,'doctor_post_detail','question_detail','answer_detail','question_answer_detail') then '内容详情页搜索框'
) t when action ='详情页高亮词' then '详情页高亮词搜索'
) n LATERAL VIEW explode(n.search_entrance) v AS search_entrance when action='大家都在看' then '首页feed大家都在看'
group by day_id, device_os_type, active_type, v.search_entrance; when action='热搜词' then '美购首页热搜词' else null end
\ No newline at end of file having search_entrance is not null
)t
)n
LATERAL VIEW explode(n.search_entrance) v AS search_entrance
group by day_id,device_os_type,active_type,v.search_entrance;
\ No newline at end of file
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