Commit 307e8e52 authored by 魏艺敏's avatar 魏艺敏

Merge branch 'weiyimin' into 'master'

push codes

See merge request !73
parents 2f7cf2ba 2ba52ed6
select *
from
(
SELECT partition_day as `日期`
SELECT partition_day as `日期`
,count(post_id) as `帖子数量`
,nvl(concat(round(sum(click_pv_1)/sum(exp_pv_1)*100,2),'%'),0) as `前1日ctr`
,nvl(sum(exp_pv_1),0) as `前1日曝光`
,nvl(round(avg(avg_page_stay_1),2),0) as `前1日平均阅读时长(s)`
,nvl(concat(round(sum(click_pv_3)/sum(exp_pv_3)*100,2),'%'),0) as `前3日ctr`
,nvl(sum(exp_pv_3),0) as `前3日曝光`
,nvl(round(avg(avg_page_stay_3),2),0) as `前3日平均阅读时长(s)`
,nvl(concat(round(sum(click_pv_10)/sum(exp_pv_10)*100,2),'%'),0) as `前10日ctr`
,nvl(sum(exp_pv_10),0) as `前10日曝光`
,nvl(round(avg(avg_page_stay_10),2),0) as `前10日平均阅读时长(s)`
FROM pm.tl_pm_userpost_d
where partition_day>='20200911' and partition_day<='20200922'
group by partition_day
union all
SELECT partition_day as `日期`
,count(post_id) as `帖子数量`
,nvl(concat(round(sum(click_pv_1)/sum(exp_pv_1)*100,2),'%'),0) as `前1日ctr`
,nvl(sum(exp_pv_1),0) as `前1日曝光`
,nvl(concat(round(sum(page_pv_20s_1)/sum(exp_pv_1)*100,2),'%'),0) as `日优秀浏览点击ctr`
,nvl(round(avg(avg_page_stay_1),2),0) as `前1日平均阅读时长(s)`
,nvl(concat(round(sum(click_pv_3)/sum(exp_pv_3)*100,2),'%'),0) as `前3日ctr`
,nvl(sum(exp_pv_3),0) as `前3日曝光`
,nvl(round(avg(avg_page_stay_3),2),0) as `前3日平均阅读时长(s)`
,nvl(concat(round(sum(click_pv_10)/sum(exp_pv_10)*100,2),'%'),0) as `前10日ctr`
,nvl(sum(exp_pv_10),0) as `前10日曝光`
,nvl(round(avg(avg_page_stay_10),2),0) as `前10日平均阅读时长(s)`
FROM pm.tl_pm_userpost_d_v2
where partition_day>='20200923'
group by partition_day
)a
,nvl(sum(exp_pv),0) as `历史曝光`
,nvl(concat(round(sum(click_pv)/sum(exp_pv)*100,2),'%'),0) as `历史ctr`
,nvl(concat(round(sum(page_pv_20s)/sum(exp_pv)*100,2),'%'),0) as `历史优秀浏览点击ctr`
,nvl(round(avg(avg_page_stay),2),0) as `历史平均阅读时长(s)`
FROM pm.tl_pm_userpost_d_v2
where partition_day>='20200915'
group by partition_day
order by `日期`
\ No newline at end of file
......@@ -7,7 +7,7 @@ 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';
......
......@@ -4,6 +4,6 @@ SELECT day_id as `日期`
,round((sum(CASE WHEN device_os_type = 'android' AND user_type='非首日签到用户' THEN wel_pv END)/sum(CASE WHEN device_os_type = 'android' and user_type='非首日签到用户' THEN active_num END))/(sum(CASE WHEN device_os_type = 'android' THEN wel_pv END)/sum(CASE WHEN device_os_type = 'android' THEN active_num END)),2) as `单个android非首日签到贡献商品核心页PV/单个android老贡献商品核心页PV`
,round((sum(CASE WHEN device_os_type = 'android' AND user_type='非首日签到用户' THEN clue_pv END)/sum(CASE WHEN device_os_type = 'android' AND user_type='非首日签到用户' THEN active_num END))/(sum(CASE WHEN device_os_type = 'android' THEN clue_pv END)/sum(CASE WHEN device_os_type = 'android' THEN active_num END)),2) as `单个android非首日签到贡献有效线索人次/单个android老贡献有效线索人次`
FROM pm.tl_pm_sign_deepaction_d
where partition_day in ('20200831','20200930','20201031','20201130','20201231',regexp_replace(date_sub(current_date,1),'-',''))
where partition_day in ('20200731','20200831','20200930','20201031','20201130','20201231',regexp_replace(date_sub(current_date,1),'-',''))
group by day_id
order by `日期`
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