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
307e8e52
Commit
307e8e52
authored
Oct 15, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'weiyimin' into 'master'
push codes See merge request
!73
parents
2f7cf2ba
2ba52ed6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
37 deletions
+16
-37
data_by_day.sql
pm/daily_userpost/report/data_by_day.sql
+14
-35
sign_daily.sql
pm/sign_daily/etl/sign_daily.sql
+1
-1
sign_daily.sql
pm/sign_daily/report/sign_daily.sql
+1
-1
No files found.
pm/daily_userpost/report/data_by_day.sql
View file @
307e8e52
select
*
SELECT
partition_day
as
`日期`
from
,
count
(
post_id
)
as
`帖子数量`
(
,
nvl
(
sum
(
exp_pv_1
),
0
)
as
`前1日曝光`
SELECT
partition_day
as
`日期`
,
nvl
(
concat
(
round
(
sum
(
click_pv_1
)
/
sum
(
exp_pv_1
)
*
100
,
2
),
'%'
),
0
)
as
`前1日ctr`
,
count
(
post_id
)
as
`帖子数量`
,
nvl
(
concat
(
round
(
sum
(
page_pv_20s_1
)
/
sum
(
exp_pv_1
)
*
100
,
2
),
'%'
),
0
)
as
`日优秀浏览点击ctr`
,
nvl
(
concat
(
round
(
sum
(
click_pv_1
)
/
sum
(
exp_pv_1
)
*
100
,
2
),
'%'
),
0
)
as
`前1日ctr`
,
nvl
(
round
(
avg
(
avg_page_stay_1
),
2
),
0
)
as
`前1日平均阅读时长(s)`
,
nvl
(
sum
(
exp_pv_1
),
0
)
as
`前1日曝光`
,
nvl
(
sum
(
exp_pv
),
0
)
as
`历史曝光`
,
nvl
(
round
(
avg
(
avg_page_stay_1
),
2
),
0
)
as
`前1日平均阅读时长(s)`
,
nvl
(
concat
(
round
(
sum
(
click_pv
)
/
sum
(
exp_pv
)
*
100
,
2
),
'%'
),
0
)
as
`历史ctr`
,
nvl
(
concat
(
round
(
sum
(
click_pv_3
)
/
sum
(
exp_pv_3
)
*
100
,
2
),
'%'
),
0
)
as
`前3日ctr`
,
nvl
(
concat
(
round
(
sum
(
page_pv_20s
)
/
sum
(
exp_pv
)
*
100
,
2
),
'%'
),
0
)
as
`历史优秀浏览点击ctr`
,
nvl
(
sum
(
exp_pv_3
),
0
)
as
`前3日曝光`
,
nvl
(
round
(
avg
(
avg_page_stay
),
2
),
0
)
as
`历史平均阅读时长(s)`
,
nvl
(
round
(
avg
(
avg_page_stay_3
),
2
),
0
)
as
`前3日平均阅读时长(s)`
FROM
pm
.
tl_pm_userpost_d_v2
,
nvl
(
concat
(
round
(
sum
(
click_pv_10
)
/
sum
(
exp_pv_10
)
*
100
,
2
),
'%'
),
0
)
as
`前10日ctr`
where
partition_day
>=
'20200915'
,
nvl
(
sum
(
exp_pv_10
),
0
)
as
`前10日曝光`
group
by
partition_day
,
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
(
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
order
by
`日期`
order
by
`日期`
\ No newline at end of file
pm/sign_daily/etl/sign_daily.sql
View file @
307e8e52
...
@@ -7,7 +7,7 @@ set hive.auto.convert.join=true;
...
@@ -7,7 +7,7 @@ set hive.auto.convert.join=true;
SET
mapred
.
reduce
.
tasks
=
20
;
SET
mapred
.
reduce
.
tasks
=
20
;
SET
role
admin
;
SET
role
admin
;
--线索日报
ADD
JAR
hdfs
:
///
user
/
hive
/
share
/
lib
/
udf
/
hive
-
udf
-
1
.
0
-
SNAPSHOT
.
jar
;
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'
;
...
...
pm/sign_daily/report/sign_daily.sql
View file @
307e8e52
...
@@ -4,6 +4,6 @@ SELECT day_id as `日期`
...
@@ -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
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老贡献有效线索人次`
,
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
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
(
'20200
731'
,
'20200
831'
,
'20200930'
,
'20201031'
,
'20201130'
,
'20201231'
,
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
))
group
by
day_id
group
by
day_id
order
by
`日期`
order
by
`日期`
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