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
78961a83
Commit
78961a83
authored
Sep 24, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'weiyimin' into 'master'
push codes See merge request
!61
parents
05bbb72c
73059c01
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
41 deletions
+50
-41
daily_operation.sql
pm/daily_operation/etl/daily_operation.sql
+3
-0
create_userpost.sql
pm/daily_userpost/etl/create_userpost.sql
+4
-4
create_userpost_v2.sql
pm/daily_userpost/etl/create_userpost_v2.sql
+8
-8
daily_userpost.sql
pm/daily_userpost/etl/daily_userpost.sql
+1
-0
data_by_day.sql
pm/daily_userpost/report/data_by_day.sql
+34
-29
No files found.
pm/daily_operation/etl/daily_operation.sql
View file @
78961a83
...
...
@@ -151,6 +151,8 @@ SELECT concat_ws('-',substr(t1.partition_date,1,4),substr(t1.partition_date,5,2)
,
coalesce
(
neirong_click_pv
,
0
)
as
`neirong_click_pv`
,
concat
(
round
(
coalesce
(
wel_second_pv
,
0
)
/
neirongPV
*
100
,
2
),
'%'
)
as
`wel_second_pv_in_neirongPV`
,
concat
(
round
(
coalesce
(
neirong_second_pv
,
0
)
/
neirongPV
*
100
,
2
),
'%'
)
as
`neirong_second_pv_in_neirongPV`
,
coalesce
(
t4
.
neirongPV
,
0
)
as
`pv`
,
coalesce
(
t4
.
neirongPV_20s
,
0
)
as
`pv_20`
FROM
...
...
@@ -303,6 +305,7 @@ LEFT JOIN
SELECT
partition_date
,
cl_type
,
device_type
,
channel
,
count
(
case
when
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'
)
then
1
else
null
end
)
as
neirongPV
,
count
(
case
when
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'
)
and
page_stay
>=
20
then
1
else
null
end
)
as
neirongPV_20s
,
count
(
DISTINCT
case
when
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'
)
then
t1
.
cl_id
else
null
end
)
as
neirongUV
,
count
(
case
when
action
=
'page_view'
AND
page_name
=
'search_result_more'
then
1
else
null
end
)
as
result_more_PV
,
count
(
DISTINCT
case
when
action
=
'page_view'
AND
page_name
=
'search_result_more'
then
t1
.
cl_id
else
null
end
)
as
result_more_UV
...
...
pm/daily_userpost/etl/create_userpost.sql
View file @
78961a83
...
...
@@ -20,8 +20,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d
title
string
comment
'{"chs_name":"帖子标题","description":"","etl":"","value":"","remark":""}'
,
audit_date
string
comment
'{"chs_name":"最新审核时间","description":"","etl":"","value":"","remark":""}'
,
tag_list
string
comment
'{"chs_name":"关联标签","description":"","etl":"","value":"","remark":""}'
,
click_pv_1
bigint
comment
'{"chs_name":"前1日点击","description":"","etl":"","value":"","remark":""}'
,
exp_pv_1
bigint
comment
'{"chs_name":"前1日曝光","description":"","etl":"","value":"","remark":""}'
,
click_pv_1
bigint
comment
'{"chs_name":"前1日点击","description":"","etl":"","value":"","remark":""}'
,
page_pv_1
bigint
comment
'{"chs_name":"前1日浏览pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_1
bigint
comment
'{"chs_name":"前1日真实评论","description":"","etl":"","value":"","remark":""}'
,
vote_num_1
bigint
comment
'{"chs_name":"前1日真实点赞","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -29,8 +29,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d
share_num_1
bigint
comment
'{"chs_name":"前1日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_1
double
comment
'{"chs_name":"前1日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv_3
bigint
comment
'{"chs_name":"前3日点击","description":"","etl":"","value":"","remark":""}'
,
exp_pv_3
bigint
comment
'{"chs_name":"前3日曝光","description":"","etl":"","value":"","remark":""}'
,
click_pv_3
bigint
comment
'{"chs_name":"前3日点击","description":"","etl":"","value":"","remark":""}'
,
page_pv_3
bigint
comment
'{"chs_name":"前3日浏览pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_3
bigint
comment
'{"chs_name":"前3日真实评论","description":"","etl":"","value":"","remark":""}'
,
vote_num_3
bigint
comment
'{"chs_name":"前3日真实点赞","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -38,8 +38,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d
share_num_3
bigint
comment
'{"chs_name":"前3日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_3
double
comment
'{"chs_name":"前3日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv_10
bigint
comment
'{"chs_name":"前10日点击","description":"","etl":"","value":"","remark":""}'
,
exp_pv_10
bigint
comment
'{"chs_name":"前10日曝光","description":"","etl":"","value":"","remark":""}'
,
click_pv_10
bigint
comment
'{"chs_name":"前10日点击","description":"","etl":"","value":"","remark":""}'
,
page_pv_10
bigint
comment
'{"chs_name":"前10日浏览pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_10
bigint
comment
'{"chs_name":"前10日真实评论","description":"","etl":"","value":"","remark":""}'
,
vote_num_10
bigint
comment
'{"chs_name":"前10日真实点赞","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -47,8 +47,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d
share_num_10
bigint
comment
'{"chs_name":"前10日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_10
double
comment
'{"chs_name":"前10日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv
bigint
comment
'{"chs_name":"历史点击","description":"","etl":"","value":"","remark":""}'
,
exp_pv
bigint
comment
'{"chs_name":"历史曝光","description":"","etl":"","value":"","remark":""}'
,
click_pv
bigint
comment
'{"chs_name":"历史点击","description":"","etl":"","value":"","remark":""}'
,
page_pv
bigint
comment
'{"chs_name":"历史浏览pv","description":"","etl":"","value":"","remark":""}'
,
reply_num
bigint
comment
'{"chs_name":"历史真实评论","description":"","etl":"","value":"","remark":""}'
,
vote_num
bigint
comment
'{"chs_name":"历史真实点赞","description":"","etl":"","value":"","remark":""}'
,
...
...
pm/daily_userpost/etl/create_userpost_v2.sql
View file @
78961a83
...
...
@@ -20,8 +20,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d_v2
title
string
comment
'{"chs_name":"帖子标题","description":"","etl":"","value":"","remark":""}'
,
audit_date
string
comment
'{"chs_name":"最新审核时间","description":"","etl":"","value":"","remark":""}'
,
tag_list
string
comment
'{"chs_name":"关联标签","description":"","etl":"","value":"","remark":""}'
,
click_pv_1
bigint
comment
'{"chs_name":"前1日点击
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_1
bigint
comment
'{"chs_name":"前1日曝光
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_1
bigint
comment
'{"chs_name":"前1日曝光
","description":"","etl":"","value":"","remark":""}'
,
click_pv_1
bigint
comment
'{"chs_name":"前1日点击
","description":"","etl":"","value":"","remark":""}'
,
page_pv_1
bigint
comment
'{"chs_name":"前1日浏览pv","description":"","etl":"","value":"","remark":""}'
,
page_pv_20s_1
bigint
comment
'{"chs_name":"前1日浏览20s以上pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_1
bigint
comment
'{"chs_name":"前1日真实评论","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d_v2
share_num_1
bigint
comment
'{"chs_name":"前1日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_1
double
comment
'{"chs_name":"前1日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv_3
bigint
comment
'{"chs_name":"前3日点击
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_3
bigint
comment
'{"chs_name":"前3日曝光
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_3
bigint
comment
'{"chs_name":"前3日曝光
","description":"","etl":"","value":"","remark":""}'
,
click_pv_3
bigint
comment
'{"chs_name":"前3日点击
","description":"","etl":"","value":"","remark":""}'
,
page_pv_3
bigint
comment
'{"chs_name":"前3日浏览pv","description":"","etl":"","value":"","remark":""}'
,
page_pv_20s_3
bigint
comment
'{"chs_name":"前3日浏览20s以上pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_3
bigint
comment
'{"chs_name":"前3日真实评论","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -40,8 +40,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d_v2
share_num_3
bigint
comment
'{"chs_name":"前3日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_3
double
comment
'{"chs_name":"前3日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv_10
bigint
comment
'{"chs_name":"前10日点击
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_10
bigint
comment
'{"chs_name":"前10日曝光
","description":"","etl":"","value":"","remark":""}'
,
exp_pv_10
bigint
comment
'{"chs_name":"前10日曝光
","description":"","etl":"","value":"","remark":""}'
,
click_pv_10
bigint
comment
'{"chs_name":"前10日点击
","description":"","etl":"","value":"","remark":""}'
,
page_pv_10
bigint
comment
'{"chs_name":"前10日浏览pv","description":"","etl":"","value":"","remark":""}'
,
page_pv_20s_10
bigint
comment
'{"chs_name":"前10日浏览20s以上pv","description":"","etl":"","value":"","remark":""}'
,
reply_num_10
bigint
comment
'{"chs_name":"前10日真实评论","description":"","etl":"","value":"","remark":""}'
,
...
...
@@ -50,8 +50,8 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_userpost_d_v2
share_num_10
bigint
comment
'{"chs_name":"前10日转发","description":"","etl":"","value":"","remark":""}'
,
avg_page_stay_10
double
comment
'{"chs_name":"前10日平均阅读时长(s)","description":"","etl":"","value":"","remark":""}'
,
click_pv
bigint
comment
'{"chs_name":"历史点击
","description":"","etl":"","value":"","remark":""}'
,
exp_pv
bigint
comment
'{"chs_name":"历史曝光
","description":"","etl":"","value":"","remark":""}'
,
exp_pv
bigint
comment
'{"chs_name":"历史曝光
","description":"","etl":"","value":"","remark":""}'
,
click_pv
bigint
comment
'{"chs_name":"历史点击
","description":"","etl":"","value":"","remark":""}'
,
page_pv
bigint
comment
'{"chs_name":"历史浏览pv","description":"","etl":"","value":"","remark":""}'
,
page_pv_20s
bigint
comment
'{"chs_name":"历史浏览20s以上pv","description":"","etl":"","value":"","remark":""}'
,
reply_num
bigint
comment
'{"chs_name":"历史真实评论","description":"","etl":"","value":"","remark":""}'
,
...
...
pm/daily_userpost/etl/daily_userpost.sql
View file @
78961a83
...
...
@@ -111,6 +111,7 @@ join
,
sum
(
exp_pv
)
as
exp_pv
,
sum
(
click_pv
)
as
click_pv
,
sum
(
page_pv
)
as
page_pv
,
sum
(
page_pv_20s
)
as
page_pv_20s
,
round
(
sum
(
page_stay
)
/
count
(
distinct
e
.
cl_id
,
e
.
partition_date
),
2
)
as
avg_page_stay
from
(
--曝光
...
...
pm/daily_userpost/report/data_by_day.sql
View file @
78961a83
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
select
*
from
(
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
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
(
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
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
partition_day
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_v2
where
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
partition_day
)
a
order
by
`日期`
\ No newline at end of file
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