Commit 57b8f8a9 authored by 魏艺敏's avatar 魏艺敏

Merge branch 'weiyimin' into 'master'

push codes

See merge request !111
parents d1778820 8005fe7a
daily_grey_recommend=策略灰度实验数据
home_grey_recommend=策略灰度实验数据
--***************************************************************
--*脚本名称:
--*功能: 策略实验数据日报
--*业务名称: pm
--*输入数据:
--*作者: weiyimin@igengmei.com
--*更新时间:
--***************************************************************
--设置全局变量&UDF
SET mapreduce.job.queuename=data;
--使用bl数据库
USE pm;
--创建BL层内部表
CREATE TABLE IF NOT EXISTS pm.tl_pm_grey_recommend_d
(
day_id string comment '{"chs_name":"当天日期","description":"","etl":"","value":"","remark":""}',
device_os_type string comment '{"chs_name":"设备类型","description":"","etl":"","value":"","remark":""}',
active_type string comment '{"chs_name":"活跃类型","description":"","etl":"","value":"","remark":""}',
grey_type string comment '{"chs_name":"灰度类型","description":"","etl":"","value":"","remark":""}',
channel string comment '{"chs_name":"渠道","description":"","etl":"","value":"","remark":""}',
retention_rate string comment '{"chs_name":"次留率","description":"","etl":"","value":"","remark":""}',
ctr string comment '{"chs_name":"首页信息流综合ctr","description":"","etl":"","value":"","remark":""}',
card_exp_pv bigint comment '{"chs_name":"卡片曝光pv","description":"","etl":"","value":"","remark":""}',
card_click_pv bigint comment '{"chs_name":"卡片点击pv","description":"","etl":"","value":"","remark":""}',
exp_pv_per_uv double comment '{"chs_name":"人均卡片曝光","description":"","etl":"","value":"","remark":""}',
card_pv_per_uv double comment '{"chs_name":"人均卡片点击","description":"","etl":"","value":"","remark":""}',
card_exp_uv bigint comment '{"chs_name":"卡片曝光uv","description":"","etl":"","value":"","remark":""}',
card_click_uv bigint comment '{"chs_name":"卡片点击uv","description":"","etl":"","value":"","remark":""}',
avg_content_pagestay double comment '{"chs_name":"单内容浏览时长(m)","description":"","etl":"","value":"","remark":""}',
avg_app_duration double comment '{"chs_name":"单设备使用时长(m)","description":"","etl":"","value":"","remark":""}',
pagestay_in_app_duration string comment '{"chs_name":"内容浏览时长在app使用时长上的占比","description":"","etl":"","value":"","remark":""}',
wel_second_in_content_pv string comment '{"chs_name":"来自内容页的商业二跳/内容pv","description":"","etl":"","value":"","remark":""}',
content_second_in_content_pv string comment '{"chs_name":"来自内容页的内容二跳/内容pv","description":"","etl":"","value":"","remark":""}',
home_cardclick_uv_in_home_uv string comment '{"chs_name":"首页卡片点击uv/首页uv","description":"","etl":"","value":"","remark":""}',
home_goodclick_uv_in_homeclick_uv string comment '{"chs_name":"good click卡片数uv/首页点击卡片数uv","description":"","etl":"","value":"","remark":""}'
)comment '策略实验数据'
PARTITIONED BY (PARTITION_DAY STRING comment '分区日期')
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
COLLECTION ITEMS TERMINATED BY '\002'
MAP KEYS TERMINATED BY '\003'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
\ No newline at end of file
SET mapreduce.job.queuename=data;
SET mapreduce.map.memory.mb=8192;
SET mapreduce.map.java.opts=-Xmx8000m;
SET mapreduce.reduce.memory.mb=8192;
SET mapreduce.reduce.java.opts=-Xmx8000m;
set hive.auto.convert.join=true;
SET mapred.reduce.tasks=20;
SET role admin;
ADD JAR hdfs:///user/hive/share/lib/udf/hive-udf-1.0-SNAPSHOT.jar;
CREATE TEMPORARY FUNCTION convup AS 'com.gmei.hive.common.udf.UDFConvUpgrade';
CREATE TEMPORARY FUNCTION setencryption AS 'com.gmei.hive.common.udf.UDFStringSetEncryption';
INSERT OVERWRITE TABLE pm.tl_pm_grey_recommend_d PARTITION (PARTITION_DAY = ${partition_day})
SELECT t1.partition_date as day_id
,t1.device_os_type
,t1.active_type
,t1.grey_type
,t1.channel
,nvl(concat(round(count(distinct t3.device_id)/count(distinct t1.device_id)*100,2),'%'),0) as retention_rate
,nvl(concat(round(sum(t4.click_pv)/sum(t4.exp_pv)*100,2),'%'),0) as ctr
,nvl(sum(t4.exp_pv),0) as card_exp_pv
,nvl(sum(t4.click_pv),0) as card_click_pv
,nvl(round(sum(t4.exp_pv)/count(distinct case when t4.exp_pv>0 then t4.cl_id end),2),0) as exp_pv_per_uv
,nvl(round(sum(t4.click_pv)/count(distinct case when t4.click_pv>0 then t4.cl_id end),2),0) as card_pv_per_uv
,count(distinct case when t4.exp_pv>0 then t4.cl_id end) as card_exp_uv
,count(distinct case when t4.click_pv>0 then t4.cl_id end) as card_click_uv
,nvl(round(sum(t5.page_stay)/count(distinct t5.cl_id)/60,2),0) as avg_content_pagestay
,nvl(round(sum(t7.use_duration)/count(distinct t7.device_id)/60,2),0) as avg_app_duration
,nvl(concat(round(sum(t5.page_stay)/sum(t7.use_duration)*100,2),'%'),0) as pagestay_in_app_duration
,nvl(concat(round(sum(t8.pv)/sum(t4.click_pv)*100,2),'%'),0) as wel_second_in_content_pv
,nvl(concat(round(sum(t9.pv)/sum(t4.click_pv)*100,2),'%'),0) as content_second_in_content_pv
,nvl(concat(round(count(distinct t10.cl_id)/count(distinct t11.cl_id)*100,2),'%'),0) as home_cardclick_uv_in_home_uv
,nvl(concat(round(sum(business_num)/count(distinct t10.cl_id)*100,2),'%'),0) as home_goodclick_uv_in_homeclick_uv
from
(
select mas.partition_date,mas.device_id,device_os_type,active_type
,a.grey_type
,e.channel
from
(
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,m.device_id,device_os_type
,case when active_type in ('1','2') then '新增设备'
when active_type ='4' then '老活跃设备' end as active_type
,array(case when (partition_date>='20201024' and substr(convup(setencryption(m.device_id,'sha-1'),16,10),-2,2)%20 in (5,6,7,8)) then '灰度' else '非灰' end,'合计') as grey_type
,array(CASE WHEN (a.device_id is not null or b.device_id is not null
or first_channel_source_type like '%xinyouxingkong%'
or first_channel_source_type like '%jingmeng%'
or first_channel_source_type like '%longyuzhixing%'
or first_channel_source_type like '%mailuo%') THEN '渠道可疑'
WHEN tmp.is_ai_channel='true' THEN 'AI' ELSE '其他' END , '合计') as channel
from online.ml_device_day_active_status m
LEFT JOIN
(SELECT code,is_spam,is_ai_channel,partition_day
FROM DIM.DIM_AI_CHANNEL_ZP_NEW
WHERE partition_day>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_day<=regexp_replace(DATE_SUB(current_date,1) ,'-',''))tmp
on first_channel_source_type=tmp.code and m.partition_date=tmp.partition_day
LEFT JOIN
(SELECT DISTINCT device_id
FROM al.al_pm_ct_dv_deviceappversionrollbackfrom20190101_d
WHERE partition_day = regexp_replace(DATE_SUB(current_date,2) ,'-',''))a
ON m.device_id = a.device_id
LEFT JOIN
(SELECT device_id,day_id
FROM pm.tl_pm_channel_d
WHERE partition_day = regexp_replace(DATE_SUB(current_date,1) ,'-','')
GROUP BY device_id,day_id)b
ON m.device_id = b.device_id AND m.partition_date = b.day_id
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and active_type in ('1','2','4')
and m.first_channel_source_type not in ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3'
,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang'
,'js-az1','js-az2','js-az3','js-az4','js-az5','jfq-az1','jfq-az2','jfq-az3','jfq-az4','jfq-az5','toufang1'
,'toufang2','toufang3','toufang4','toufang5','toufang6','TF-toufang1','TF-toufang2','TF-toufang3','TF-toufang4'
,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100'
,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ'
,'promotion_shike','promotion_julang_jl03','promotion_zuimei','','unknown')
AND first_channel_source_type not like 'promotion\_jf\_%'
)mas
LATERAL VIEW EXPLODE(grey_type) a as grey_type
LATERAL VIEW EXPLODE(channel) e as channel
)t1
left join
(
SELECT device_id
,concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
FROM online.ml_device_day_active_status
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
)t3
on t1.device_id=t3.device_id and date_add(t1.partition_date,1)=t3.partition_date
left join
(
SELECT t2.partition_date,t2.cl_id
,sum(t2.pv) as exp_pv
,sum(t3.pv) as click_pv
from
(--精准曝光,卡片id和session_id去重
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date,
cl_id,
card_id,
count(distinct app_session_id) as pv
from online.ml_community_precise_exposure_detail
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action in ('page_precise_exposure','home_choiceness_card_exposure') --7745版本action改为page_precise_exposure
AND is_exposure = '1' ----精准曝光
AND page_name ='home'
AND tab_name = '精选'
AND (transaction_type in ('-1','smr','hotspot','pgc','newdata','hotspot_feed','aistragegy','excestragegy')
or transaction_type like '%ctr' or transaction_type like '%cvr' or transaction_type like '%deeplink%')
AND card_content_type in ('qa','diary','user_post','answer','special_pool')
group by partition_date,
cl_id,
card_id
)t2
LEFT JOIN
(--卡片,卡片id和session_id去重
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date,
cl_id,
params['card_id'] as card_id,
count(distinct app_session_id) as pv
from online.bl_hdfs_maidian_updates
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_card'
AND params['page_name'] ='home'
AND params['tab_name'] = '精选'
AND (params['transaction_type'] in ('-1','smr','hotspot','pgc','newdata','hotspot_feed','aistragegy','excestragegy')
or params['transaction_type'] like '%ctr' or params['transaction_type'] like '%cvr' or params['transaction_type'] like '%deeplink%')
AND params['card_content_type'] in ('qa','diary','user_post','answer','special_pool')
GROUP BY partition_date,
cl_id,
params['card_id']
)t3
on t2.partition_date=t3.partition_date
and t2.cl_id=t3.cl_id
and t2.card_id=t3.card_id
group by t2.partition_date,t2.cl_id
)t4
on t1.partition_date =t4.partition_date and t1.device_id=t4.cl_id
LEFT JOIN
(--内容时长
select concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,cl_id,sum(page_stay) as page_stay
from online.bl_hdfs_maidian_updates
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and action='page_view'
and page_stay >= 0 and page_stay < 1000
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
and referrer='home'
group by partition_date,cl_id
)t5
on t1.partition_date =t5.partition_date and t1.device_id=t5.cl_id
LEFT JOIN
(--app使用时长
select concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,device_id,use_duration
from online.ml_device_updates
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
)t7
on t1.partition_date =t7.partition_date and t1.device_id=t7.device_id
left join
(
SELECT cl_id,concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,count(distinct time_str) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
and params['referrer'] in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
AND ((action='on_click_button' and params['button_name'] = 'more_recommendations')
or (action='on_click_button' and params['button_name']='video_interview')
or (action='on_click_button' and params['button_name']='referral')
or (action ='on_click_card' and params['card_content_type']='service'))
group by cl_id,partition_date
)t8
on t1.partition_date =t8.partition_date and t1.device_id=t8.cl_id
left join
(
SELECT cl_id,concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,count(distinct time_str) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
AND params['referrer'] in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail') --内容详情页-搜索首页-进行搜索
and (action in ('on_click_navbar_search','do_search')
or (action ='on_click_card' and params['card_type']='highlight_word')
or (action='on_click_card' and params['card_content_type'] in ('qa','diary','user_post','answer')))
group by cl_id,partition_date
)t9
on t1.partition_date =t9.partition_date and t1.device_id=t9.cl_id
LEFT JOIN
(
select partition_date,cl_id
from
( --首页feed卡片点击
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,cl_id
-- ,count(distinct array(params['card_id'],app_session_id)) as click_pv
FROM online.bl_hdfs_maidian_updates
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and action='on_click_card'
and page_name='home'
and params['card_type']='card'
group by partition_date
,cl_id
UNION ALL
--点击埋点有丢失,用浏览事件补充一下
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,cl_id
-- ,count(distinct array(params['card_id'],app_session_id)) as click_pv
FROM online.bl_hdfs_maidian_updates
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and action='page_view'
and (referrer in ('home') or
(params['referrer_link'] like '%[%' and
json_split(params['referrer_link'])[size(json_split(params['referrer_link']))-1] in ('home')))
and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
group by partition_date
,cl_id
)t10
group by partition_date,cl_id
)t10
on t1.partition_date =t10.partition_date and t1.device_id=t10.cl_id
LEFT JOIN
(--首页浏览
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date
,cl_id
FROM online.bl_hdfs_maidian_updates
where partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action = 'page_view'
AND page_name='home'
group by concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)),cl_id
)t11
on t1.partition_date=t11.partition_date and t1.device_id=t11.cl_id
LEFT JOIN
( --内容的good click代码
select concat_ws('-',substr(a.partition_date,1,4),substr(a.partition_date,5,2),substr(a.partition_date,7,2)) as partition_date
,a.cl_id
,count(distinct a.business_id) as business_num
from
(
select *,case when page_name in ('diary_detail','topic_detail') THEN 'diary'
when page_name in ('post_detail','user_post_detail','doctor_post_detail') THEN 'post'
when page_name in ('answer_detail') THEN 'answer' end content_type
FROM ONLINE.BL_HDFS_MAIDIAN_UPDATES
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,2) ,'-','')
and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and (referrer='home' or
(params['referrer_link'] like '%[%' and
json_split(params['referrer_link'])[size(json_split(params['referrer_link']))-1]='home'))
and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail',
'video_steep','article_detail')
)a
left join
(--评论的埋点有缺失,所以用业务库数据来补充
--日记这里取的是日记本id,因为从首页点击卡片进入后,先进入日记卡片
SELECT diary_id as content_id,'diary' as type,user_id,create_date
FROM
(
SELECT id,problem_id,user_id,regexp_replace(substr(reply_date,1,10),'-','') as create_date
FROM online.tl_hdfs_topicreply_view
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND is_spam = 'false' --排除疑似广告
and is_online='true'
and regexp_replace(substr(reply_date,1,10),'-','') >= regexp_replace(DATE_SUB(current_date,2) ,'-','')
and regexp_replace(substr(reply_date,1,10),'-','') <= regexp_replace(DATE_SUB(current_date,1) ,'-','')
group by id,problem_id,user_id,reply_date
)t1
JOIN
(
SELECT id,diary_id
FROM online.tl_hdfs_problem_view
WHERE partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
group by id,diary_id
)t2
on t2.id=t1.problem_id
group by diary_id,user_id,create_date
UNION ALL
--有评论过回答的设备,排除疑似广告
SELECT answer_id as content_id,'answer' as type,user_id,regexp_replace(substr(create_time,1,10),'-','') as create_date
FROM online.tl_hdfs_answer_reply_view
WHERE partition_date =regexp_replace(DATE_SUB(current_date,1) ,'-','')
and (is_fake is NULL or is_fake = 'false')
AND answer_id is not NULL
and is_online='true'
and is_spam = 'false' --排除疑似广告
and regexp_replace(substr(create_time,1,10),'-','') >= regexp_replace(DATE_SUB(current_date,2) ,'-','')
and regexp_replace(substr(create_time,1,10),'-','') <= regexp_replace(DATE_SUB(current_date,1) ,'-','')
group by answer_id,user_id,create_time
UNION ALL
--有评论过用户帖的设备
SELECT tractate_id as content_id,'post' as type,user_id,regexp_replace(substr(create_time,1,10),'-','') as create_date
FROM online.tl_hdfs_api_tractate_reply_view
WHERE partition_date =regexp_replace(DATE_SUB(current_date,1) ,'-','')
and regexp_replace(substr(create_time,1,10),'-','') >= regexp_replace(DATE_SUB(current_date,2) ,'-','')
and regexp_replace(substr(create_time,1,10),'-','') <= regexp_replace(DATE_SUB(current_date,1) ,'-','')
and is_online='true'
group by tractate_id,user_id,create_time
)b
on a.business_id=b.content_id and a.partition_date=b.create_date and a.user_id=b.user_id and a.content_type=b.type
WHERE ((action='page_view' and page_stay>=20)--浏览时长大约20s
or action in ('on_click_navbar_search','do_search') --二跳:点击搜索框和搜索按钮
or (action='on_click_card' and params['card_type']='highlight_word')--二跳:高亮词
or (action='on_click_card' and params['card_content_type']in ('service','qa','diary','user_post','answer'))--二跳:点击卡片
or (action='on_click_button' and params['button_name'] in ('video_interview','referral'))--二跳:点击转诊和视频面诊
or (action='on_click_favor' and params['motion']='do')--点击收藏
or action='page_click_share'--点击分享
or (action='on_click_vote' and params['motion']='vote')--点击点赞
or b.user_id is not null )--当天有针对内容的评论
group by a.partition_date,a.cl_id
)t12
on t1.partition_date=t12.partition_date and t1.device_id=t12.cl_id
left join
( -- 去掉黑名单设备
select distinct device_id
from ML.ML_D_CT_DV_DEVICECLEAN_DIMEN_D
where PARTITION_DAY = regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND is_abnormal_device = 'true'
)spam_pv
on t1.device_id =spam_pv.device_id
WHERE spam_pv.device_id IS NULL
group by t1.partition_date,t1.device_os_type,t1.active_type,t1.channel,t1.grey_type
#step1_1.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_device_day_active_status
\ No newline at end of file
#step1_2.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_community_precise_exposure_detail
\ No newline at end of file
#step1_3.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online bl_hdfs_maidian_updates
\ No newline at end of file
#step1_4.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive ml ml_d_ct_dv_devicespam_d
\ No newline at end of file
#step1_5.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_user_updates
\ No newline at end of file
#step1_6.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive DIM DIM_AI_CHANNEL_ZP_NEW
\ No newline at end of file
#step1_7.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive ml ml_c_ct_ui_user_dimen_d
\ No newline at end of file
#step1_8.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_user_history_detail
\ No newline at end of file
#step1_9.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_device_history_detail
\ No newline at end of file
#step2.job
type=command
dependencies=step1_1,step1_2,step1_3,step1_4,step1_5,step1_6,step1_7,step1_8,step1_9
command=sh /home/bi/bi-report/lib/shell/hive daily_grey_recommend
\ No newline at end of file
#step3.job
type=command
dependencies=step2
command=curl -X GET http://localhost:8553/api/report/email/daily_grey_recommend/shenzheng@igengmei.com,wangxin@igengmei.com,zhaoyang@igengmei.com,duanyingrong@igengmei.com,xuepengfei@igengmei.com,wanglidan@igengmei.com/weiyimin@igengmei.com,hanyingyue@igengmei.com,jiaqingqing@igengmei.com
\ No newline at end of file
SELECT day_id as `日期`
,device_os_type as `系统`
,active_type as `活跃`
,grey_type as `灰度`
,channel as `渠道`
,retention_rate as `次留率`
,ctr as `首页信息流综合ctr`
,card_exp_pv as `卡片曝光pv`
,card_click_pv as `卡片点击pv`
,exp_pv_per_uv`人均卡片曝光`
,card_pv_per_uv`人均卡片点击`
,card_exp_uv as `卡片曝光uv`
,card_click_uv as `卡片点击uv`
,avg_content_pagestay as `单内容浏览时长(m)`
,avg_app_duration as `单设备使用时长(m)`
,pagestay_in_app_duration as `内容浏览时长在app使用时长上的占比`
,wel_second_in_content_pv`来自内容页的商业二跳/内容pv`
,content_second_in_content_pv`来自内容页的内容二跳/内容pv`
,home_cardclick_uv_in_home_uv as `首页卡片点击uv/首页uv`
,home_goodclick_uv_in_homeclick_uv as `good click卡片数uv/首页点击卡片数uv`
from pm.tl_pm_grey_recommend_d
where ((partition_day='20201112' and day_id<='20201111')
or (partition_day>'20201112' and partition_day<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
and day_id=date_sub(concat_ws('-',substr(partition_day,1,4),substr(partition_day,5,2),substr(partition_day,7,2)),1)))
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