Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
e1214360
Commit
e1214360
authored
Sep 23, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'weiyimin' into 'master'
push codes See merge request
!59
parents
d486e776
412f7382
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
220 additions
and
22 deletions
+220
-22
create_daily_operation_v2.sql
pm/daily_operation/etl/create_daily_operation_v2.sql
+101
-0
daily_operation.sql
pm/daily_operation/etl/daily_operation.sql
+1
-1
daily_operation.sql
pm/daily_operation/report/daily_operation.sql
+5
-3
create_daily_recommend_strategy_v2.sql
...mmend_strategy/etl/create_daily_recommend_strategy_v2.sql
+47
-0
daily_recommend_strategy.sql
pm/daily_recommend_strategy/etl/daily_recommend_strategy.sql
+45
-4
home_recommend_strategy.sql
...ily_recommend_strategy/report/home_recommend_strategy.sql
+14
-6
daily_userpost.sql
pm/daily_userpost/etl/daily_userpost.sql
+7
-8
No files found.
pm/daily_operation/etl/create_daily_operation_v2.sql
0 → 100644
View file @
e1214360
--***************************************************************
--*脚本名称:
--*功能: 运营日报
--*业务名称: pm
--*输入数据:
--*作者: weiyimin@igengmei.com
--*更新时间:
--***************************************************************
--设置全局变量&UDF
SET
mapreduce
.
job
.
queuename
=
data
;
--使用bl数据库
USE
pm
;
--创建BL层内部表
CREATE
TABLE
IF
NOT
EXISTS
pm
.
tl_pm_operation_d_v2
(
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":""}'
,
channel
string
comment
'{"chs_name":"渠道","description":"","etl":"","value":"","remark":""}'
,
dau
bigint
comment
'{"chs_name":"dau(去除积分墙)","description":"","etl":"","value":"","remark":""}'
,
login_dev_num
bigint
comment
'{"chs_name":"新增注册设备数","description":"","etl":"","value":"","remark":""}'
,
login_user_num
bigint
comment
'{"chs_name":"新增注册账号","description":"","etl":"","value":"","remark":""}'
,
login_phone_user_num
bigint
comment
'{"chs_name":"新增注册手机号用户数","description":"","etl":"","value":"","remark":""}'
,
retention_1
string
comment
'{"chs_name":"次日留存率","description":"","etl":"","value":"","remark":""}'
,
retention_7
string
comment
'{"chs_name":"第7日留存率","description":"","etl":"","value":"","remark":""}'
,
retention_30
string
comment
'{"chs_name":"第30日留存率","description":"","etl":"","value":"","remark":""}'
,
per_open_times
bigint
comment
'{"chs_name":"单设备打开频次","description":"","etl":"","value":"","remark":""}'
,
home_feeds_ctr
string
comment
'{"chs_name":"信息流内容ctr","description":"","etl":"","value":"","remark":""}'
,
per_use_time
double
comment
'{"chs_name":"单设备app停留时长(M)","description":"","etl":"","value":"","remark":""}'
,
neirong_page_stay
double
comment
'{"chs_name":"单设备内容时长(M)","description":"","etl":"","value":"","remark":""}'
,
neirong_in_app_use_time
string
comment
'{"chs_name":"单设备内容时长/app停留时长","description":"","etl":"","value":"","remark":""}'
,
service_privacy_uv
bigint
comment
'{"chs_name":"到达隐私授权界面设备数","description":"","etl":"","value":"","remark":""}'
,
service_click_uv
bigint
comment
'{"chs_name":"同意隐私授权设备设备数","description":"","etl":"","value":"","remark":""}'
,
service_privacy_uv_in_dau
string
comment
'{"chs_name":"到达隐私授权界面设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
service_click_uv_in_dau
string
comment
'{"chs_name":"同意隐私授权设备数/到达隐私授权界面设备数","description":"","etl":"","value":"","remark":""}'
,
open_push_uv
bigint
comment
'{"chs_name":"开启推送授权设备数","description":"","etl":"","value":"","remark":""}'
,
open_push_uv_in_dau
string
comment
'{"chs_name":"开启推送授权设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
push_receive_uv_in_open_push_uv
string
comment
'{"chs_name":"次日接收推送设备数/当天开启推送授权设备数","description":"","etl":"","value":"","remark":""}'
,
click_uv
bigint
comment
'{"chs_name":"点击推送的设备数","description":"","etl":"","value":"","remark":""}'
,
non_click_uv
bigint
comment
'{"chs_name":"未点击推送的设备数","description":"","etl":"","value":"","remark":""}'
,
click_uv_in_dau
string
comment
'{"chs_name":"点击推送设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
non_click_uv_in_dau
string
comment
'{"chs_name":"未点击推送设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
op_push_open_uv
bigint
comment
'{"chs_name":"点击运营推送设备数","description":"","etl":"","value":"","remark":""}'
,
auto_push_open_uv
bigint
comment
'{"chs_name":"点击系统推送设备数","description":"","etl":"","value":"","remark":""}'
,
personal_push_open_uv
bigint
comment
'{"chs_name":"点击个性化推送设备数","description":"","etl":"","value":"","remark":""}'
,
sign_push_open_uv
bigint
comment
'{"chs_name":"点击签到推送设备数","description":"","etl":"","value":"","remark":""}'
,
op_push_open_uv_in_receive
string
comment
'{"chs_name":"点击运营推送设备/接收到运营推送设备","description":"","etl":"","value":"","remark":""}'
,
auto_push_open_uv_in_receive
string
comment
'{"chs_name":"点击系统推送设备/接收到系统推送设备","description":"","etl":"","value":"","remark":""}'
,
personal_push_open_uv_in_receive
string
comment
'{"chs_name":"点击个性化推送设备/接收到个性化推送设备","description":"","etl":"","value":"","remark":""}'
,
sign_push_open_uv_in_receive
string
comment
'{"chs_name":"点击签到推送设备/接收到签到推送设备","description":"","etl":"","value":"","remark":""}'
,
question_num
bigint
comment
'{"chs_name":"主动提问数","description":"","etl":"","value":"","remark":""}'
,
answer_num
bigint
comment
'{"chs_name":"主动回答数","description":"","etl":"","value":"","remark":""}'
,
topic_num
bigint
comment
'{"chs_name":"主动发帖数","description":"","etl":"","value":"","remark":""}'
,
reply_num
bigint
comment
'{"chs_name":"真实评论数","description":"","etl":"","value":"","remark":""}'
,
question_num_in_dau
string
comment
'{"chs_name":"主动提问设备数/DAU`","description":"","etl":"","value":"","remark":""}'
,
answer_num_in_dau
string
comment
'{"chs_name":"主动回答设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
topic_num_in_dau
string
comment
'{"chs_name":"主动发帖设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
reply_num_in_dau
string
comment
'{"chs_name":"主动评论设备数/DAU","description":"","etl":"","value":"","remark":""}'
,
neirongUV
bigint
comment
'{"chs_name":"内容UV","description":"","etl":"","value":"","remark":""}'
,
neirongPV
bigint
comment
'{"chs_name":"内容PV","description":"","etl":"","value":"","remark":""}'
,
neirongUV_in_dau
string
comment
'{"chs_name":"内容UV/DAU","description":"","etl":"","value":"","remark":""}'
,
neirongPV_in_UV
double
comment
'{"chs_name":"内容PV/内容UV","description":"","etl":"","value":"","remark":""}'
,
result_more_UV
bigint
comment
'{"chs_name":"搜索结果综合页UV","description":"","etl":"","value":"","remark":""}'
,
result_meigou_UV
bigint
comment
'{"chs_name":"搜索结果美购页UV","description":"","etl":"","value":"","remark":""}'
,
result_con_UV
bigint
comment
'{"chs_name":"搜索结果商业页UV","description":"","etl":"","value":"","remark":""}'
,
result_more_UV_in_dau
string
comment
'{"chs_name":"搜索结果综合页UV/DAU","description":"","etl":"","value":"","remark":""}'
,
result_meigou_UV_in_dau
string
comment
'{"chs_name":"搜索结果美购页UV/DAU","description":"","etl":"","value":"","remark":""}'
,
result_con_UV_in_dau
string
comment
'{"chs_name":"搜索结果商业页UV/DAU","description":"","etl":"","value":"","remark":""}'
,
result_more_PV
bigint
comment
'{"chs_name":"搜索结果综合页PV","description":"","etl":"","value":"","remark":""}'
,
result_meigou_PV
bigint
comment
'{"chs_name":"搜索结果美购页PV","description":"","etl":"","value":"","remark":""}'
,
result_con_PV
bigint
comment
'{"chs_name":"搜索结果商业页PV","description":"","etl":"","value":"","remark":""}'
,
result_more_PV_in_UV
double
comment
'{"chs_name":"搜索结果综合页PV/搜索结果综合页UV","description":"","etl":"","value":"","remark":""}'
,
result_meigou_PV_in_UV
double
comment
'{"chs_name":"搜索结果美购页PV/搜索结果美购页UV","description":"","etl":"","value":"","remark":""}'
,
result_con_PV_in_UV
double
comment
'{"chs_name":"搜索结果商业页PV/搜索结果商业页UV","description":"","etl":"","value":"","remark":""}'
,
result_more_PV_in_dau
string
comment
'{"chs_name":"搜索结果综合页PV/DAU","description":"","etl":"","value":"","remark":""}'
,
result_meigou_PV_in_dau
string
comment
'{"chs_name":"搜索结果美购页PV/DAU","description":"","etl":"","value":"","remark":""}'
,
result_con_PV_in_dau
string
comment
'{"chs_name":"搜索结果商业页PV/DAU","description":"","etl":"","value":"","remark":""}'
,
neirong_meigou_PV
bigint
comment
'{"chs_name":"来自内容页的美购页PV","description":"","etl":"","value":"","remark":""}'
,
neirong_con_PV
bigint
comment
'{"chs_name":"来自内容页的商业页PV","description":"","etl":"","value":"","remark":""}'
,
neirong_meigou_PV_in_dau
string
comment
'{"chs_name":"来自内容页的美购页PV/DAU","description":"","etl":"","value":"","remark":""}'
,
neirong_con_PV_in_dau
string
comment
'{"chs_name":"来自内容页的商业页PV/DAU","description":"","etl":"","value":"","remark":""}'
,
neirong_click_pv
bigint
comment
'{"chs_name":"内容页的推荐内容点击pv","description":"","etl":"","value":"","remark":""}'
,
wel_second_pv_in_neirongPV
string
comment
'{"chs_name":"来自内容页的商业二跳/内容pv","description":"","etl":"","value":"","remark":""}'
,
neirong_second_pv_in_neirongPV
string
comment
'{"chs_name":"来自内容页的内容二跳/内容pv","description":"","etl":"","value":"","remark":""}'
,
pv
bigint
comment
'{"chs_name":"全站的帖子日记问答浏览pv","description":"","etl":"","value":"","remark":""}'
,
pv_20
bigint
comment
'{"chs_name":"全站的帖子日记问答浏览>20pv","description":"","etl":"","value":"","remark":""}'
)
comment
'运营日报'
PARTITIONED
BY
(
PARTITION_DAY
STRING
comment
'分区日期'
)
ROW
FORMAT
DELIMITED
FIELDS
TERMINATED
BY
'
\t
'
COLLECTION
ITEMS
TERMINATED
BY
'
\0
02'
MAP
KEYS
TERMINATED
BY
'
\0
03'
LINES
TERMINATED
BY
'
\n
'
STORED
AS
TEXTFILE
;
\ No newline at end of file
pm/daily_operation/etl/daily_operation.sql
View file @
e1214360
...
@@ -79,7 +79,7 @@ INSERT OVERWRITE TABLE pm.tl_pm_channel_d PARTITION (PARTITION_DAY = ${partition
...
@@ -79,7 +79,7 @@ INSERT OVERWRITE TABLE pm.tl_pm_channel_d PARTITION (PARTITION_DAY = ${partition
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_operation_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_operation_d
_v2
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
SELECT
concat_ws
(
'-'
,
substr
(
t1
.
partition_date
,
1
,
4
),
substr
(
t1
.
partition_date
,
5
,
2
),
substr
(
t1
.
partition_date
,
7
,
2
))
as
day_id
SELECT
concat_ws
(
'-'
,
substr
(
t1
.
partition_date
,
1
,
4
),
substr
(
t1
.
partition_date
,
5
,
2
),
substr
(
t1
.
partition_date
,
7
,
2
))
as
day_id
,
t1
.
device_os_type
as
device_os_type
,
t1
.
device_os_type
as
device_os_type
...
...
pm/daily_operation/report/daily_operation.sql
View file @
e1214360
...
@@ -69,8 +69,10 @@ SELECT day_id `日期`
...
@@ -69,8 +69,10 @@ SELECT day_id `日期`
,
nvl
(
neirong_click_pv
,
0
)
as
`内容页的推荐内容点击pv`
,
nvl
(
neirong_click_pv
,
0
)
as
`内容页的推荐内容点击pv`
,
nvl
(
wel_second_pv_in_neirongPV
,
0
)
as
`来自内容页的商业二跳/内容pv`
,
nvl
(
wel_second_pv_in_neirongPV
,
0
)
as
`来自内容页的商业二跳/内容pv`
,
nvl
(
neirong_second_pv_in_neirongPV
,
0
)
as
`来自内容页的内容二跳/内容pv`
,
nvl
(
neirong_second_pv_in_neirongPV
,
0
)
as
`来自内容页的内容二跳/内容pv`
FROM
pm
.
tl_pm_operation_d
,
nvl
(
pv
,
0
)
as
`全站日记帖子问答详情页浏览>20 pv`
where
((
partition_day
=
'20200906'
and
day_id
<=
'2020-08-08'
)
,
nvl
(
concat
(
round
(
pv_20
/
pv
*
100
,
2
),
'%'
),
0
)
as
`全站日记帖子问答详情页浏览>20 pv/同口径下不限制浏览时长总pv`
or
(
partition_day
<
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
partition_day
>
'20200906'
and
day_id
=
date_sub
(
FROM_UNIXTIME
(
UNIX_TIMESTAMP
(
partition_day
,
'yyyymmdd'
),
'yyyy-mm-dd'
),
29
))
FROM
pm
.
tl_pm_operation_d_v2
where
((
partition_day
=
'20200922'
and
day_id
<=
'2020-08-25'
)
or
(
partition_day
<
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
partition_day
>
'20200922'
and
day_id
=
date_sub
(
FROM_UNIXTIME
(
UNIX_TIMESTAMP
(
partition_day
,
'yyyymmdd'
),
'yyyy-mm-dd'
),
29
))
or
(
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
day_id
>=
date_sub
(
current_date
,
30
)))
or
(
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
day_id
>=
date_sub
(
current_date
,
30
)))
order
by
`日期`
desc
,
`系统`
,
`新老`
,
`渠道`
order
by
`日期`
desc
,
`系统`
,
`新老`
,
`渠道`
pm/daily_recommend_strategy/etl/create_daily_recommend_strategy_v2.sql
0 → 100644
View file @
e1214360
--***************************************************************
--*脚本名称:
--*功能: 首页推荐策略日报,和另一张日报pm.tl_pm_recommend_strategy_d的区别是增加了来自首页卡片点击pv的浏览时长>=20秒
--*业务名称: pm
--*输入数据:
--*作者: weiyimin@igengmei.com
--*更新时间:
--***************************************************************
--设置全局变量&UDF
SET
mapreduce
.
job
.
queuename
=
data
;
--使用bl数据库
USE
pm
;
--创建BL层内部表
CREATE
TABLE
IF
NOT
EXISTS
pm
.
tl_pm_recommend_strategy_d_v2
(
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":""}'
,
card_content_type
string
comment
'{"chs_name":"卡片类型","description":"","etl":"","value":"","remark":""}'
,
recommend_type
string
comment
'{"chs_name":"推荐类型","description":"","etl":"","value":"","remark":""}'
,
card_click
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
card_exposure
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay
double
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
page_pv
bigint
comment
'{"chs_name":"来自首页卡片的浏览pv","description":"","etl":"","value":"","remark":""}'
,
page_pv_20
bigint
comment
'{"chs_name":"来自首页卡片点击pv的浏览时长>=20秒的pv","description":"","etl":"","value":"","remark":""}'
,
navbar_search
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
highlight_word
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
self_welfare_card
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
recommend_welfare_card
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
recommend_content_card
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
recommend_special_card
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
transfer_card
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
video_consultation
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
total_post_pv
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
,
post_click_pv
bigint
comment
'{"chs_name":"","description":"","etl":"","value":"","remark":""}'
)
comment
'首页推荐策略日报'
PARTITIONED
BY
(
PARTITION_DAY
STRING
comment
'分区日期'
)
ROW
FORMAT
DELIMITED
FIELDS
TERMINATED
BY
'
\t
'
COLLECTION
ITEMS
TERMINATED
BY
'
\0
02'
MAP
KEYS
TERMINATED
BY
'
\0
03'
LINES
TERMINATED
BY
'
\n
'
STORED
AS
TEXTFILE
;
\ No newline at end of file
pm/daily_recommend_strategy/etl/daily_recommend_strategy.sql
View file @
e1214360
...
@@ -11,7 +11,7 @@ ADD JAR hdfs:///user/hive/share/lib/udf/hive-udf-1.0-SNAPSHOT.jar;
...
@@ -11,7 +11,7 @@ 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
convup
AS
'com.gmei.hive.common.udf.UDFConvUpgrade'
;
--进制转换函数,支持各种进制转换
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_recommend_strategy_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_recommend_strategy_d
_v2
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
SELECT
SELECT
t1
.
partition_date
as
day_id
,
t1
.
partition_date
as
day_id
,
t1
.
device_os_type
as
device_os_type
,
t1
.
device_os_type
as
device_os_type
,
...
@@ -21,6 +21,8 @@ SELECT
...
@@ -21,6 +21,8 @@ SELECT
NVL
(
sum
(
t3
.
session_pv
),
0
)
as
card_click
,
NVL
(
sum
(
t3
.
session_pv
),
0
)
as
card_click
,
NVL
(
sum
(
t2
.
session_pv
),
0
)
as
card_exposure
,
NVL
(
sum
(
t2
.
session_pv
),
0
)
as
card_exposure
,
NVL
(
round
(
sum
(
page_stay
)
/
count
(
distinct
t4
.
cl_id
)
/
60
,
2
),
0
)
as
avg_page_stay
,
NVL
(
round
(
sum
(
page_stay
)
/
count
(
distinct
t4
.
cl_id
)
/
60
,
2
),
0
)
as
avg_page_stay
,
NVL
(
sum
(
t4_pv
.
pv
),
0
)
as
page_pv
,
NVL
(
sum
(
t4_pv
.
pv_20
),
0
)
as
page_pv_20
,
NVL
(
sum
(
navbar_pv
),
0
)
as
navbar_search
,
NVL
(
sum
(
navbar_pv
),
0
)
as
navbar_search
,
NVL
(
sum
(
highlight_pv
),
0
)
as
highlight_word
,
NVL
(
sum
(
highlight_pv
),
0
)
as
highlight_word
,
NVL
(
sum
(
self_wel_pv
),
0
)
as
self_welfare_card
,
NVL
(
sum
(
self_wel_pv
),
0
)
as
self_welfare_card
,
...
@@ -182,7 +184,8 @@ FROM
...
@@ -182,7 +184,8 @@ FROM
and
t2
.
recommend_type
=
t3
.
recommend_type
and
t2
.
recommend_type
=
t3
.
recommend_type
LEFT
JOIN
LEFT
JOIN
(
--页面浏览时长
(
--页面浏览时长
select
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
)
as
business_id
,
a
.
page_name
,
page_stay
select
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
)
as
business_id
,
a
.
page_name
,
sum
(
page_stay
)
as
page_stay
from
from
(
(
SELECT
partition_date
,
cl_id
,
business_id
,
SELECT
partition_date
,
cl_id
,
business_id
,
...
@@ -190,7 +193,7 @@ FROM
...
@@ -190,7 +193,7 @@ FROM
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
as
page_name
,
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
as
page_name
,
sum
(
page_stay
)
as
page_stay
page_stay
,
time_str
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
=
'page_view'
AND
action
=
'page_view'
...
@@ -201,7 +204,7 @@ FROM
...
@@ -201,7 +204,7 @@ FROM
case
when
page_name
in
(
'diary_detail'
,
'topic_detail'
)
then
'diary'
case
when
page_name
in
(
'diary_detail'
,
'topic_detail'
)
then
'diary'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
,
page_stay
,
time_str
)
a
)
a
left
join
left
join
(
(
...
@@ -211,12 +214,50 @@ FROM
...
@@ -211,12 +214,50 @@ FROM
group
by
id
,
visual_page_id
group
by
id
,
visual_page_id
)
b
)
b
on
a
.
business_id
=
b
.
visual_page_id
and
a
.
page_name
=
b
.
page_name
on
a
.
business_id
=
b
.
visual_page_id
and
a
.
page_name
=
b
.
page_name
group
by
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
),
a
.
page_name
)
t4
)
t4
on
t4
.
partition_date
=
t3
.
partition_date
on
t4
.
partition_date
=
t3
.
partition_date
and
t4
.
cl_id
=
t3
.
cl_id
and
t4
.
cl_id
=
t3
.
cl_id
and
t4
.
business_id
=
t3
.
card_id
and
t4
.
business_id
=
t3
.
card_id
and
t4
.
page_name
=
t3
.
card_content_type
and
t4
.
page_name
=
t3
.
card_content_type
LEFT
JOIN
LEFT
JOIN
(
--页面浏览时长
select
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
)
as
business_id
,
a
.
page_name
,
count
(
1
)
as
pv
,
count
(
case
when
page_stay
>=
20
then
1
end
)
as
pv_20
from
(
SELECT
partition_date
,
cl_id
,
business_id
,
case
when
page_name
in
(
'diary_detail'
,
'topic_detail'
)
then
'diary'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
as
page_name
,
time_str
,
page_stay
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'page_view'
AND
page_name
IN
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
,
'custom_special'
)
AND
referrer
=
'home'
GROUP
BY
partition_date
,
cl_id
,
business_id
,
case
when
page_name
in
(
'diary_detail'
,
'topic_detail'
)
then
'diary'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
then
'user_post'
when
page_name
in
(
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'qa'
when
page_name
in
(
'custom_special'
)
then
'special'
else
null
end
,
time_str
,
page_stay
)
a
left
join
(
select
id
,
visual_page_id
,
'special'
as
page_name
from
tl
.
tl_zx_api_special_pool
where
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
id
,
visual_page_id
)
b
on
a
.
business_id
=
b
.
visual_page_id
and
a
.
page_name
=
b
.
page_name
group
by
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
),
a
.
page_name
)
t4_pv
on
t4_pv
.
partition_date
=
t3
.
partition_date
and
t4_pv
.
cl_id
=
t3
.
cl_id
and
t4_pv
.
business_id
=
t3
.
card_id
and
t4_pv
.
page_name
=
t3
.
card_content_type
LEFT
JOIN
(
--搜索框和点击行为
(
--搜索框和点击行为
select
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
)
as
business_id
,
a
.
page_name
,
navbar_pv
select
partition_date
,
cl_id
,
coalesce
(
b
.
id
,
a
.
business_id
)
as
business_id
,
a
.
page_name
,
navbar_pv
from
from
...
...
pm/daily_recommend_strategy/report/home_recommend_strategy.sql
View file @
e1214360
...
@@ -39,7 +39,9 @@ from
...
@@ -39,7 +39,9 @@ from
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
(
page_pv_20
/
page_pv
*
100
,
2
),
'%'
),
0
)
as
`来源于首页的内容详情页浏览>20 pv/同口径下总内容详情页浏览pv`
,
card_click
as
`首页卡片点击PV`
,
card_click
as
`首页卡片点击PV`
,
page_pv_20
as
`来源于首页的内容详情页浏览>20 pv`
,
card_exposure
as
`首页卡片精准曝光PV`
,
card_exposure
as
`首页卡片精准曝光PV`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
...
@@ -51,8 +53,8 @@ from
...
@@ -51,8 +53,8 @@ from
transfer_card
as
`来自I的转诊点击pv`
,
transfer_card
as
`来自I的转诊点击pv`
,
video_consultation
as
`来自I的视频面诊点击pv`
,
video_consultation
as
`来自I的视频面诊点击pv`
,
if
(
total_post_pv
-
post_click_pv
>=
0
,
total_post_pv
-
post_click_pv
,
0
)
as
`帖子页链接点击pv(近似值)`
if
(
total_post_pv
-
post_click_pv
>=
0
,
total_post_pv
-
post_click_pv
,
0
)
as
`帖子页链接点击pv(近似值)`
from
pm
.
tl_pm_recommend_strategy_d
from
pm
.
tl_pm_recommend_strategy_d
_v2
WHERE
partition_day
>=
'202009
07
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_day
>=
'202009
22
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
card_content_type
not
in
(
'special'
)
and
card_content_type
not
in
(
'special'
)
and
recommend_type
not
in
(
'新用户AI帖优先'
,
'热点卡片'
,
'新用户精华帖优先'
,
'hotspot_feed'
,
'合计'
,
'保量'
)
and
recommend_type
not
in
(
'新用户AI帖优先'
,
'热点卡片'
,
'新用户精华帖优先'
,
'hotspot_feed'
,
'合计'
,
'保量'
)
...
@@ -67,7 +69,9 @@ from
...
@@ -67,7 +69,9 @@ from
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
(
page_pv_20
/
page_pv
*
100
,
2
),
'%'
),
0
)
as
`来源于首页的内容详情页浏览>20 pv/同口径下总内容详情页浏览pv`
,
card_click
as
`首页卡片点击PV`
,
card_click
as
`首页卡片点击PV`
,
page_pv_20
as
`来源于首页的内容详情页浏览>20 pv`
,
card_exposure
as
`首页卡片精准曝光PV`
,
card_exposure
as
`首页卡片精准曝光PV`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
...
@@ -79,8 +83,8 @@ from
...
@@ -79,8 +83,8 @@ from
transfer_card
as
`来自I的转诊点击pv`
,
transfer_card
as
`来自I的转诊点击pv`
,
video_consultation
as
`来自I的视频面诊点击pv`
,
video_consultation
as
`来自I的视频面诊点击pv`
,
if
(
total_post_pv
-
post_click_pv
>=
0
,
total_post_pv
-
post_click_pv
,
0
)
as
`帖子页链接点击pv(近似值)`
if
(
total_post_pv
-
post_click_pv
>=
0
,
total_post_pv
-
post_click_pv
,
0
)
as
`帖子页链接点击pv(近似值)`
from
pm
.
tl_pm_recommend_strategy_d
from
pm
.
tl_pm_recommend_strategy_d
_v2
WHERE
partition_day
>=
'202009
07
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_day
>=
'202009
22
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
card_content_type
not
in
(
'special'
)
and
card_content_type
not
in
(
'special'
)
and
recommend_type
=
'保量'
and
recommend_type
=
'保量'
...
@@ -95,7 +99,9 @@ from
...
@@ -95,7 +99,9 @@ from
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
(
card_click
/
card_exposure
*
100
,
2
),
'%'
),
0
)
as
`首页卡片点击PV/首页卡片精准曝光PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
/
card_click
*
100
,
2
),
'%'
),
0
)
as
`来自首页推荐内容卡片的的有效二跳pv/首页卡片点击PV`
,
NVL
(
CONCAT
(
ROUND
(
page_pv_20
/
page_pv
*
100
,
2
),
'%'
),
0
)
as
`来源于首页的内容详情页浏览>20 pv/同口径下总内容详情页浏览pv`
,
card_click
as
`首页卡片点击PV`
,
card_click
as
`首页卡片点击PV`
,
page_pv_20
as
`来源于首页的内容详情页浏览>20 pv`
,
card_exposure
as
`首页卡片精准曝光PV`
,
card_exposure
as
`首页卡片精准曝光PV`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
(
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
+
total_post_pv
-
post_click_pv
)
as
`有效二跳pv`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
avg_page_stay
as
`来自I的单PV平均浏览时长`
,
...
@@ -116,6 +122,8 @@ from
...
@@ -116,6 +122,8 @@ from
card_content_type
,
card_content_type
,
sum
(
card_click
)
as
card_click
,
sum
(
card_click
)
as
card_click
,
sum
(
card_exposure
)
as
card_exposure
,
sum
(
card_exposure
)
as
card_exposure
,
sum
(
page_pv
)
as
page_pv
,
sum
(
page_pv_20
)
as
page_pv_20
,
round
(
avg
(
avg_page_stay
),
2
)
as
avg_page_stay
,
round
(
avg
(
avg_page_stay
),
2
)
as
avg_page_stay
,
sum
(
navbar_search
)
as
navbar_search
,
sum
(
navbar_search
)
as
navbar_search
,
sum
(
highlight_word
)
as
highlight_word
,
sum
(
highlight_word
)
as
highlight_word
,
...
@@ -126,8 +134,8 @@ from
...
@@ -126,8 +134,8 @@ from
sum
(
video_consultation
)
as
video_consultation
,
sum
(
video_consultation
)
as
video_consultation
,
sum
(
total_post_pv
)
as
total_post_pv
,
sum
(
total_post_pv
)
as
total_post_pv
,
sum
(
post_click_pv
)
as
post_click_pv
sum
(
post_click_pv
)
as
post_click_pv
from
pm
.
tl_pm_recommend_strategy_d
from
pm
.
tl_pm_recommend_strategy_d
_v2
WHERE
partition_day
>=
'202009
07
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_day
>=
'202009
22
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
card_content_type
not
in
(
'special'
)
and
card_content_type
not
in
(
'special'
)
and
recommend_type
not
in
(
'新用户AI帖优先'
,
'热点卡片'
,
'新用户精华帖优先'
,
'hotspot_feed'
,
'合计'
,
'保量'
)
and
recommend_type
not
in
(
'新用户AI帖优先'
,
'热点卡片'
,
'新用户精华帖优先'
,
'hotspot_feed'
,
'合计'
,
'保量'
)
group
by
day_id
,
device_os_type
,
active_type
,
card_content_type
group
by
day_id
,
device_os_type
,
active_type
,
card_content_type
...
...
pm/daily_userpost/etl/daily_userpost.sql
View file @
e1214360
...
@@ -147,14 +147,13 @@ join
...
@@ -147,14 +147,13 @@ join
on
a
.
partition_date
=
e
.
partition_date
and
a
.
card_id
=
e
.
business_id
and
a
.
cl_id
=
e
.
cl_id
on
a
.
partition_date
=
e
.
partition_date
and
a
.
card_id
=
e
.
business_id
and
a
.
cl_id
=
e
.
cl_id
full
join
full
join
(
--浏览pv
(
--浏览pv
SELECT
partition_date
,
cl_id
,
params
[
'business_id'
]
as
business_id
,
count
(
distinct
time_str
)
as
page_pv
SELECT
partition_date
,
cl_id
,
params
[
'business_id'
]
as
business_id
,
count
(
distinct
time_str
)
as
page_pv
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20160101'
WHERE
partition_date
>=
'20160101'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'page_view'
and
action
=
'page_view'
and
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
and
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
group
by
partition_date
,
cl_id
,
params
[
'business_id'
]
group
by
partition_date
,
cl_id
,
params
[
'business_id'
]
)
f
)
f
on
a
.
partition_date
=
f
.
partition_date
and
nvl
(
a
.
card_id
,
e
.
business_id
)
=
f
.
business_id
and
nvl
(
a
.
cl_id
,
e
.
cl_id
)
=
f
.
cl_id
on
a
.
partition_date
=
f
.
partition_date
and
nvl
(
a
.
card_id
,
e
.
business_id
)
=
f
.
business_id
and
nvl
(
a
.
cl_id
,
e
.
cl_id
)
=
f
.
cl_id
left
join
left
join
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment