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
b28d1055
Commit
b28d1055
authored
Sep 08, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push codes
parent
a88a554c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
57 deletions
+14
-57
daily_operation.sql
pm/daily_operation/report/daily_operation.sql
+4
-4
create_daily_recommend_strategy.sql
...ecommend_strategy/etl/create_daily_recommend_strategy.sql
+4
-3
create_home_retention.sql
pm/daily_recommend_strategy/etl/create_home_retention.sql
+0
-44
daily_recommend_strategy.sql
pm/daily_recommend_strategy/etl/daily_recommend_strategy.sql
+0
-1
home_recommend_strategy.sql
...ily_recommend_strategy/report/home_recommend_strategy.sql
+6
-5
No files found.
pm/daily_operation/report/daily_operation.sql
View file @
b28d1055
...
...
@@ -70,7 +70,7 @@ SELECT day_id `日期`
,
nvl
(
wel_second_pv_in_neirongPV
,
0
)
as
`来自内容页的商业二跳/内容pv`
,
nvl
(
neirong_second_pv_in_neirongPV
,
0
)
as
`来自内容页的内容二跳/内容pv`
FROM
pm
.
tl_pm_operation_d
where
((
partition_day
=
'20200906'
and
day_id
<=
'2020
08
08'
)
or
(
partition_day
<
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
partition_day
>
'20200906'
and
day_id
=
regexp_replace
(
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
>=
regexp_replace
(
date_sub
(
current_date
,
30
),
'-'
,
''
)))
order
by
`日期`
,
`系统`
,
`新老`
,
`渠道`
where
((
partition_day
=
'20200906'
and
day_id
<=
'2020
-08-
08'
)
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
))
or
(
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
day_id
>=
date_sub
(
current_date
,
30
)))
order
by
`日期`
desc
,
`系统`
,
`新老`
,
`渠道`
pm/daily_recommend_strategy/etl/create_daily_recommend_strategy.sql
View file @
b28d1055
...
...
@@ -31,9 +31,10 @@ CREATE TABLE IF NOT EXISTS pm.tl_pm_recommend_strategy_d
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":""}'
)
comment
'内容日报'
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
'
...
...
pm/daily_recommend_strategy/etl/create_home_retention.sql
deleted
100644 → 0
View file @
a88a554c
--***************************************************************
--*脚本名称:
--*功能: 首页推荐策略日报
--*业务名称: 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
(
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":""}'
,
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":""}'
)
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 @
b28d1055
...
...
@@ -20,7 +20,6 @@ SELECT
t2
.
recommend_type
as
recommend_type
,
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
(
sum
(
navbar_pv
),
0
)
as
navbar_search
,
NVL
(
sum
(
highlight_pv
),
0
)
as
highlight_word
,
...
...
pm/daily_recommend_strategy/report/home_recommend_strategy.sql
View file @
b28d1055
...
...
@@ -4,12 +4,12 @@ SELECT
active_type
as
`活跃类型`
,
card_content_type
as
`卡片类型`
,
recommend_type
as
`推荐类型`
,
NVL
(
CONCAT
(
ROUND
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
)
/
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
((
navbar_search
+
highlight_word
+
self_welfare_card
+
recommend_welfare_card
+
recommend_content_card
*
0
.
2
+
transfer_card
+
video_consultation
)
/
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`
,
card_click
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
)
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平均浏览时长`
,
navbar_search
as
`来自I的搜索框+搜索按钮点击PV`
,
highlight_word
as
`来自I的文内搜索点击PV`
,
...
...
@@ -18,8 +18,8 @@ SELECT
recommend_content_card
as
`来自I的推荐内容点击pv`
,
-- '未配置' 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(近似值)`
FROM
pm
.
tl_pm_recommend_strategy_d
WHERE
partition_day
>=
'20200
824
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_day
>=
'20200
907
'
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
order
by
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`卡片类型`
,
`推荐类型`
;
\ 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