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
bcd363f6
Commit
bcd363f6
authored
Nov 13, 2020
by
edz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push core
parent
eb0ab10b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
102 deletions
+98
-102
ai_daily.sql
pm/core_daily/report/ai_daily.sql
+43
-42
home_daily.sql
pm/core_daily/report/home_daily.sql
+30
-33
search_daily.sql
pm/core_daily/report/search_daily.sql
+25
-27
No files found.
pm/core_daily/report/ai_daily.sql
View file @
bcd363f6
--AI工具核心数据
--AI工具核心数据
SELECT
t1
.
partition_date
as
`日期`
SELECT
partition_date
as
`日期`
,
concat
(
round
(
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t3
.
cl_id
end
)
/
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
`iOS新在AI功能次留`
,
if
(
ios_new_ai_retention
=
0
.
00
%
,
'-'
,
ios_new_ai_retention
)
as
`iOS新在AI功能次留`
,
concat
(
round
(
sum
(
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
gc_num
end
)
/
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
`iOS新在AI分发页PVgood click/功能使用uv`
,
ios_new_gc_uv
as
`iOS新在AI分发页PVgood click/功能使用uv`
,
concat
(
round
(
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t3
.
cl_id
end
)
/
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
`android新在AI功能次留`
,
if
(
andr_new_ai_retention
=
0
.
00
%
,
'-'
,
andr_new_ai_retention
)
as
`android新在AI功能次留`
,
concat
(
round
(
sum
(
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
gc_num
end
)
/
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
`android新在AI分发页PVgood click/功能使用uv`
,
andr_new_gc_uv
as
`android新在AI分发页PVgood click/功能使用uv`
FROM
FROM
(
(
SELECT
t1
.
partition_date
,
concat
(
round
(
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t3
.
cl_id
end
)
/
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
ios_new_ai_retention
,
concat
(
round
(
sum
(
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
gc_num
end
)
/
count
(
distinct
case
when
device_os_type
=
'ios'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
ios_new_gc_uv
,
concat
(
round
(
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t3
.
cl_id
end
)
/
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
andr_new_ai_retention
,
concat
(
round
(
sum
(
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
gc_num
end
)
/
count
(
distinct
case
when
device_os_type
=
'android'
and
active_type
=
'新增'
and
channel
=
'ai'
then
t2
.
cl_id
end
)
*
100
,
2
),
'%'
)
as
andr_new_gc_uv
FROM
(
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
device_os_type
,
m
.
device_id
,
device_os_type
,
m
.
device_id
,
CASE
WHEN
active_type
=
'4'
THEN
'老活'
when
active_type
in
(
'1'
,
'2'
)
then
'新增'
END
as
active_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活'
when
active_type
in
(
'1'
,
'2'
)
then
'新增'
END
as
active_type
...
@@ -16,11 +24,9 @@ FROM
...
@@ -16,11 +24,9 @@ FROM
LEFT
JOIN
LEFT
JOIN
(
SELECT
code
,
is_spam
,
is_ai_channel
,
partition_day
(
SELECT
code
,
is_spam
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
'${start_date}'
and
partition_day
<
'${end_date}'
)
tmp
and
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
on
first_channel_source_type
=
tmp
.
code
and
m
.
partition_date
=
tmp
.
partition_day
on
first_channel_source_type
=
tmp
.
code
and
m
.
partition_date
=
tmp
.
partition_day
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
@@ -30,10 +36,10 @@ FROM
...
@@ -30,10 +36,10 @@ FROM
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
t1
)
t1
LEFT
JOIN
LEFT
JOIN
(
(
SELECT
partition_date
,
cl_id
,
count
(
distinct
routine
)
as
routine_num
SELECT
partition_date
,
cl_id
,
count
(
distinct
routine
)
as
routine_num
FROM
FROM
(
(
...
@@ -55,8 +61,7 @@ LEFT JOIN
...
@@ -55,8 +61,7 @@ LEFT JOIN
page_name
,
page_name
,
row_number
()
over
(
partition
by
partition_date
,
cl_id
,
app_session_id
order
by
time_str
asc
)
as
no
row_number
()
over
(
partition
by
partition_date
,
cl_id
,
app_session_id
order
by
time_str
asc
)
as
no
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
action
=
'page_view'
AND
action
=
'page_view'
GROUP
BY
partition_date
,
GROUP
BY
partition_date
,
...
@@ -69,10 +74,10 @@ LEFT JOIN
...
@@ -69,10 +74,10 @@ LEFT JOIN
WHERE
concat
(
pre_page_name
,
','
,
page_name
)
in
(
'face_scan,report_result'
,
'face_scan,face_detect_result'
,
'face_scan,face_simulator'
)
WHERE
concat
(
pre_page_name
,
','
,
page_name
)
in
(
'face_scan,report_result'
,
'face_scan,face_detect_result'
,
'face_scan,face_simulator'
)
)
c
)
c
group
by
partition_date
,
cl_id
group
by
partition_date
,
cl_id
)
t2
)
t2
ON
t1
.
device_id
=
t2
.
cl_id
AND
t1
.
partition_date
=
t2
.
partition_date
ON
t1
.
device_id
=
t2
.
cl_id
AND
t1
.
partition_date
=
t2
.
partition_date
LEFT
JOIN
LEFT
JOIN
(
(
SELECT
partition_date
,
cl_id
,
count
(
distinct
routine
)
as
routine_num
SELECT
partition_date
,
cl_id
,
count
(
distinct
routine
)
as
routine_num
FROM
FROM
(
(
...
@@ -94,8 +99,7 @@ LEFT JOIN
...
@@ -94,8 +99,7 @@ LEFT JOIN
page_name
,
page_name
,
row_number
()
over
(
partition
by
partition_date
,
cl_id
,
app_session_id
order
by
time_str
asc
)
as
no
row_number
()
over
(
partition
by
partition_date
,
cl_id
,
app_session_id
order
by
time_str
asc
)
as
no
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
action
=
'page_view'
AND
action
=
'page_view'
GROUP
BY
partition_date
,
GROUP
BY
partition_date
,
...
@@ -108,10 +112,10 @@ LEFT JOIN
...
@@ -108,10 +112,10 @@ LEFT JOIN
WHERE
concat
(
pre_page_name
,
','
,
page_name
)
in
(
'face_scan,report_result'
,
'face_scan,face_detect_result'
,
'face_scan,face_simulator'
)
WHERE
concat
(
pre_page_name
,
','
,
page_name
)
in
(
'face_scan,report_result'
,
'face_scan,face_detect_result'
,
'face_scan,face_simulator'
)
)
c
)
c
group
by
partition_date
,
cl_id
group
by
partition_date
,
cl_id
)
t3
)
t3
ON
t2
.
cl_id
=
t3
.
cl_id
AND
date_add
(
t2
.
partition_date
,
1
)
=
t3
.
partition_date
ON
t2
.
cl_id
=
t3
.
cl_id
AND
date_add
(
t2
.
partition_date
,
1
)
=
t3
.
partition_date
left
join
left
join
(
--ai分发页pv good click
(
--ai分发页pv good click
--来自于ai结果页的内容的good_click(主要是测颜值和模拟整形)
--来自于ai结果页的内容的good_click(主要是测颜值和模拟整形)
select
concat_ws
(
'-'
,
substr
(
a
.
partition_date
,
1
,
4
),
substr
(
a
.
partition_date
,
5
,
2
),
substr
(
a
.
partition_date
,
7
,
2
))
as
partition_date
,
a
.
cl_id
,
count
(
distinct
a
.
business_id
)
as
gc_num
select
concat_ws
(
'-'
,
substr
(
a
.
partition_date
,
1
,
4
),
substr
(
a
.
partition_date
,
5
,
2
),
substr
(
a
.
partition_date
,
7
,
2
))
as
partition_date
,
a
.
cl_id
,
count
(
distinct
a
.
business_id
)
as
gc_num
from
from
...
@@ -120,8 +124,7 @@ left join
...
@@ -120,8 +124,7 @@ left join
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
when
page_name
in
(
'answer_detail'
)
THEN
'answer'
end
as
content_type
when
page_name
in
(
'answer_detail'
)
THEN
'answer'
end
as
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
PARTITION_DATE
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
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_name
in
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
,
'video_steep'
,
'article_detail'
)
'video_steep'
,
'article_detail'
)
and
(
referrer
in
(
'report_result'
,
'face_detect_result'
,
'float_tag_detail'
)
or
and
(
referrer
in
(
'report_result'
,
'face_detect_result'
,
'float_tag_detail'
)
or
...
@@ -139,7 +142,7 @@ left join
...
@@ -139,7 +142,7 @@ left join
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
id
,
problem_id
,
user_id
,
reply_date
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
)
t1
JOIN
JOIN
...
@@ -163,7 +166,7 @@ left join
...
@@ -163,7 +166,7 @@ left join
AND
answer_id
is
not
NULL
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
answer_id
,
user_id
,
create_time
group
by
answer_id
,
user_id
,
create_time
UNION
ALL
UNION
ALL
...
@@ -172,7 +175,7 @@ left join
...
@@ -172,7 +175,7 @@ left join
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
FROM
online
.
tl_hdfs_api_tractate_reply_view
FROM
online
.
tl_hdfs_api_tractate_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
is_online
=
'true'
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
group
by
tractate_id
,
user_id
,
create_time
)
b
)
b
...
@@ -194,8 +197,7 @@ left join
...
@@ -194,8 +197,7 @@ left join
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
business_id
)
as
gc_num
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
business_id
)
as
gc_num
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
((
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
,
'on_click_navbar_cart'
)
AND
page_name
=
'welfare_detail'
)
--点击加车
AND
((
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
,
'on_click_navbar_cart'
)
AND
page_name
=
'welfare_detail'
)
--点击加车
or
action
=
'welfare_detail_click_message'
--点击私信
or
action
=
'welfare_detail_click_message'
--点击私信
or
(
action
=
'on_click_button'
AND
page_name
=
'welfare_detail'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
))
--点击人工咨询+预约面诊
or
(
action
=
'on_click_button'
AND
page_name
=
'welfare_detail'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
))
--点击人工咨询+预约面诊
...
@@ -219,8 +221,7 @@ left join
...
@@ -219,8 +221,7 @@ left join
--在结果页的去别的功能以及视频面诊按钮
--在结果页的去别的功能以及视频面诊按钮
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
time_str
)
as
gc_num
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
time_str
)
as
gc_num
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'on_click_button'
AND
action
=
'on_click_button'
and
params
[
'page_name'
]
in
(
'report_result'
,
'face_detect_result'
)
--测肤结果页点击完成、再测一次、扫脸、视频面诊
and
params
[
'page_name'
]
in
(
'report_result'
,
'face_detect_result'
)
--测肤结果页点击完成、再测一次、扫脸、视频面诊
AND
params
[
'button_name'
]
in
(
'ai_function'
,
'video_interview'
,
'AI测肤质'
,
'视频面诊'
,
'AI测颜值'
)
AND
params
[
'button_name'
]
in
(
'ai_function'
,
'video_interview'
,
'AI测肤质'
,
'视频面诊'
,
'AI测颜值'
)
...
@@ -232,8 +233,7 @@ left join
...
@@ -232,8 +233,7 @@ left join
select
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
business_id
)
as
gc_num
select
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
business_id
)
as
gc_num
from
online
.
bl_hdfs_maidian_updates
from
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
where
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
((
action
=
'page_view'
and
page_stay
>=
20
)
and
((
action
=
'page_view'
and
page_stay
>=
20
)
or
(
action
=
'on_click_card'
and
params
[
'card_type'
]
=
'card'
))
or
(
action
=
'on_click_card'
and
params
[
'card_type'
]
=
'card'
))
and
page_name
in
(
'search_result_question_answer'
,
'topic_aggregation'
)
and
page_name
in
(
'search_result_question_answer'
,
'topic_aggregation'
)
...
@@ -248,22 +248,23 @@ left join
...
@@ -248,22 +248,23 @@ left join
select
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
time_str
)
as
gc_num
select
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
,
count
(
distinct
time_str
)
as
gc_num
from
online
.
bl_hdfs_maidian_updates
from
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
where
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'on_click_button'
and
action
=
'on_click_button'
and
page_name
=
'float_tag_detail'
and
page_name
=
'float_tag_detail'
and
params
[
'button_name'
]
in
(
'consult'
,
'bargain'
,
'commodity_ranking'
)
and
params
[
'button_name'
]
in
(
'consult'
,
'bargain'
,
'commodity_ranking'
)
group
by
partition_date
,
cl_id
group
by
partition_date
,
cl_id
)
t4
)
t4
on
t1
.
partition_date
=
t4
.
partition_date
and
t1
.
device_id
=
t4
.
cl_id
on
t1
.
partition_date
=
t4
.
partition_date
and
t1
.
device_id
=
t4
.
cl_id
left
join
left
join
(
-- 去掉黑名单设备
(
-- 去掉黑名单设备
select
distinct
device_id
select
distinct
device_id
from
ML
.
ML_D_CT_DV_DEVICECLEAN_DIMEN_D
from
ML
.
ML_D_CT_DV_DEVICECLEAN_DIMEN_D
where
PARTITION_DAY
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
where
PARTITION_DAY
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_abnormal_device
=
'true'
AND
is_abnormal_device
=
'true'
)
spam_pv
)
spam_pv
on
t1
.
device_id
=
spam_pv
.
device_id
on
t1
.
device_id
=
spam_pv
.
device_id
WHERE
spam_pv
.
device_id
IS
NULL
WHERE
spam_pv
.
device_id
IS
NULL
GROUP
BY
GROUP
BY
t1
.
partition_date
t1
.
partition_date
)
t
order
by
`日期`
;
pm/core_daily/report/home_daily.sql
View file @
bcd363f6
...
@@ -2,25 +2,25 @@
...
@@ -2,25 +2,25 @@
--首页内容核心数据
--首页内容核心数据
SELECT
partition_date
as
`日期`
SELECT
partition_date
as
`日期`
,
ios_ym_new_click_uv
/
ios_ym_new_sy_uv
as
`iOS医美新用户首页卡片点击uv/ios医美新用户首页uv`
,
nvl
(
round
(
ios_ym_new_click_uv
/
ios_ym_new_sy_uv
,
2
),
0
)
as
`iOS医美新用户首页卡片点击uv/ios医美新用户首页uv`
,
ios_ym_new_good_click
/
ios_ym_new_card_click_uv
as
`iOS医美新用户good click 卡片数uv/iOS医美新用户首页点击卡片数uv`
,
nvl
(
round
(
ios_ym_new_good_click
/
ios_ym_new_card_click_uv
,
2
),
0
)
as
`iOS医美新用户good click 卡片数uv/iOS医美新用户首页点击卡片数uv`
,
ios_ym_old_click_uv
/
ios_ym_old_sy_uv
as
`iOS医美老用户首页卡片点击uv/iOS医美老用户首页uv`
,
nvl
(
round
(
ios_ym_old_click_uv
/
ios_ym_old_sy_uv
,
2
),
0
)
as
`iOS医美老用户首页卡片点击uv/iOS医美老用户首页uv`
,
ios_ym_old_good_click
/
ios_ym_old_card_click_uv
as
`iOS医美老用户good click 卡片数uv/iOS医美老用户首页点击卡片数uv`
,
nvl
(
round
(
ios_ym_old_good_click
/
ios_ym_old_card_click_uv
,
2
),
0
)
as
`iOS医美老用户good click 卡片数uv/iOS医美老用户首页点击卡片数uv`
,
ios_ai_new_click_uv
/
ios_ai_new_sy_uv
as
`iOS AI新用户首页卡片点击uv/iOS AI新用户首页uv`
,
nvl
(
round
(
ios_ai_new_click_uv
/
ios_ai_new_sy_uv
,
2
),
0
)
as
`iOS AI新用户首页卡片点击uv/iOS AI新用户首页uv`
,
ios_ai_new_good_click
/
ios_ai_new_card_click_uv
as
`iOS AI新用户good click 卡片数uv/iOS AI新用户首页点击卡片数uv`
,
nvl
(
round
(
ios_ai_new_good_click
/
ios_ai_new_card_click_uv
,
2
),
0
)
as
`iOS AI新用户good click 卡片数uv/iOS AI新用户首页点击卡片数uv`
,
ios_ai_old_click_uv
/
ios_ai_old_sy_uv
as
`iOS AI老用户首页卡片点击uv/iOS AI老用户首页uv`
,
nvl
(
round
(
ios_ai_old_click_uv
/
ios_ai_old_sy_uv
,
2
),
0
)
as
`iOS AI老用户首页卡片点击uv/iOS AI老用户首页uv`
,
ios_ai_old_good_click
/
ios_ai_old_card_click_uv
as
`iOS AI老用户good click 卡片数uv/iOS AI老用户首页点击卡片数uv`
,
nvl
(
round
(
ios_ai_old_good_click
/
ios_ai_old_card_click_uv
,
2
),
0
)
as
`iOS AI老用户good click 卡片数uv/iOS AI老用户首页点击卡片数uv`
,
andr_ai_new_click_uv
/
andr_ai_new_sy_uv
as
`AI安卓新用户首页卡片点击uv/AI安卓新用户首页uv`
,
nvl
(
round
(
andr_ai_new_click_uv
/
andr_ai_new_sy_uv
,
2
),
0
)
as
`AI安卓新用户首页卡片点击uv/AI安卓新用户首页uv`
,
andr_ai_new_good_click
/
andr_ai_new_card_click_uv
as
`AI安卓新用户信息流good click 卡片数uv/AI安卓新用户首页点击卡片数uv`
,
nvl
(
round
(
andr_ai_new_good_click
/
andr_ai_new_card_click_uv
,
2
),
0
)
as
`AI安卓新用户信息流good click 卡片数uv/AI安卓新用户首页点击卡片数uv`
,
andr_ai_old_click_uv
/
andr_ai_old_sy_uv
as
`AI安卓老用户首页卡片点击uv/AI安卓老用户首页uv`
,
nvl
(
round
(
andr_ai_old_click_uv
/
andr_ai_old_sy_uv
,
2
),
0
)
as
`AI安卓老用户首页卡片点击uv/AI安卓老用户首页uv`
,
andr_ai_old_good_click
/
andr_ai_old_card_click_uv
as
`AI安卓老用户信息流good click 卡片数uv/AI安卓老用户首页点击卡片数uv`
,
nvl
(
round
(
andr_ai_old_good_click
/
andr_ai_old_card_click_uv
,
2
),
0
)
as
`AI安卓老用户信息流good click 卡片数uv/AI安卓老用户首页点击卡片数uv`
,
andr_ym_new_click_uv
/
andr_ym_new_sy_uv
as
`安卓医美新用户首页卡片点击uv/安卓医美新用户首页uv`
,
nvl
(
round
(
andr_ym_new_click_uv
/
andr_ym_new_sy_uv
,
2
),
0
)
as
`安卓医美新用户首页卡片点击uv/安卓医美新用户首页uv`
,
andr_ym_new_good_click
/
andr_ym_new_card_click_uv
as
`安卓医美新用户信息流good click 卡片数uv/安卓医美新用户首页点击卡片数uv`
,
nvl
(
round
(
andr_ym_new_good_click
/
andr_ym_new_card_click_uv
,
2
),
0
)
as
`安卓医美新用户信息流good click 卡片数uv/安卓医美新用户首页点击卡片数uv`
,
andr_ym_old_click_uv
/
andr_ym_old_sy_uv
as
`安卓医美老用户首页卡片点击uv/安卓医美老用户首页uv`
,
nvl
(
round
(
andr_ym_old_click_uv
/
andr_ym_old_sy_uv
,
2
),
0
)
as
`安卓医美老用户首页卡片点击uv/安卓医美老用户首页uv`
,
andr_ym_old_good_click
/
andr_ym_old_card_click_uv
as
`安卓医美老用户信息流good click 卡片数uv/安卓医美老用户首页点击卡片数uv`
,
nvl
(
round
(
andr_ym_old_good_click
/
andr_ym_old_card_click_uv
,
2
),
0
)
as
`安卓医美老用户信息流good click 卡片数uv/安卓医美老用户首页点击卡片数uv`
FROM
FROM
(
(
...
@@ -75,11 +75,9 @@ FROM
...
@@ -75,11 +75,9 @@ FROM
LEFT
JOIN
LEFT
JOIN
(
SELECT
code
,
is_ai_channel
,
partition_day
(
SELECT
code
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
'${start_date}'
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
@@ -105,8 +103,7 @@ FROM
...
@@ -105,8 +103,7 @@ FROM
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
cl_id
as
device_id
,
cl_id
as
device_id
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
where
partition_date
>=
'${start_date}'
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
=
'home'
AND
page_name
=
'home'
group
by
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
)),
cl_id
,
params
[
'card_id'
]
group
by
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
)),
cl_id
,
params
[
'card_id'
]
...
@@ -120,8 +117,7 @@ FROM
...
@@ -120,8 +117,7 @@ FROM
,
params
[
'card_id'
]
as
card_id
,
params
[
'card_id'
]
as
card_id
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
where
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'on_click_card'
and
action
=
'on_click_card'
and
page_name
=
'home'
and
page_name
=
'home'
and
params
[
'card_type'
]
=
'card'
and
params
[
'card_type'
]
=
'card'
...
@@ -137,8 +133,7 @@ FROM
...
@@ -137,8 +133,7 @@ FROM
,
params
[
'business_id'
]
as
card_id
,
params
[
'business_id'
]
as
card_id
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
where
partition_date
>=
'${start_date}'
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
(
referrer
in
(
'home'
)
or
and
(
referrer
in
(
'home'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
(
params
[
'referrer_link'
]
like
'%[%'
and
...
@@ -160,7 +155,7 @@ FROM
...
@@ -160,7 +155,7 @@ FROM
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
when
page_name
in
(
'answer_detail'
)
THEN
'answer'
end
content_type
when
page_name
in
(
'answer_detail'
)
THEN
'answer'
end
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
PARTITION_DATE
>=
'${start_date}'
and
(
referrer
=
'home'
or
and
(
referrer
=
'home'
or
(
params
[
'referrer_link'
]
like
'%[%'
and
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
=
'home'
))
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
=
'home'
))
...
@@ -178,7 +173,7 @@ FROM
...
@@ -178,7 +173,7 @@ FROM
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
id
,
problem_id
,
user_id
,
reply_date
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
)
t1
JOIN
JOIN
...
@@ -202,7 +197,7 @@ FROM
...
@@ -202,7 +197,7 @@ FROM
AND
answer_id
is
not
NULL
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
answer_id
,
user_id
,
create_time
group
by
answer_id
,
user_id
,
create_time
UNION
ALL
UNION
ALL
...
@@ -211,7 +206,7 @@ FROM
...
@@ -211,7 +206,7 @@ FROM
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
FROM
online
.
tl_hdfs_api_tractate_reply_view
FROM
online
.
tl_hdfs_api_tractate_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
is_online
=
'true'
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
group
by
tractate_id
,
user_id
,
create_time
)
b
)
b
...
@@ -231,3 +226,4 @@ FROM
...
@@ -231,3 +226,4 @@ FROM
WHERE
t2
.
device_id
is
null
WHERE
t2
.
device_id
is
null
group
by
t1
.
partition_date
group
by
t1
.
partition_date
)
t
)
t
order
by
`日期`
;
\ No newline at end of file
pm/core_daily/report/search_daily.sql
View file @
bcd363f6
--搜索内容核心数据
--搜索内容核心数据
SELECT
t
.
partition_date
SELECT
t
.
partition_date
as
`日期`
,
old_diary_gc_uv
/
old_diary_click_uv
as
`老用户在日记页卡good click 卡片数uv/日记页卡点击uv`
,
nvl
(
round
(
old_diary_gc_uv
/
old_diary_click_uv
,
2
),
0
)
as
`老用户在日记页卡good click 卡片数uv/日记页卡点击uv`
,
old_qa_gc_uv
/
old_qa_click_uv
as
`老用户在问答页卡good click 卡片数uv/问答页卡点击uv`
,
nvl
(
round
(
old_qa_gc_uv
/
old_qa_click_uv
,
2
),
0
)
as
`老用户在问答页卡good click 卡片数uv/问答页卡点击uv`
,
'-'
as
`老用户在帖子页卡good click 卡片数uv/帖子页卡点击uv`
,
'-'
as
`老用户在帖子页卡good click 卡片数uv/帖子页卡点击uv`
--,old_post_gc_uv/old_post_click_uv as `老用户在帖子页卡good click 卡片数uv/帖子页卡点击uv`
,
nvl
(
round
(
old_wiki_gc_uv
/
old_wiki_click_uv
,
2
),
0
)
as
`老用户在百科页卡good click 卡片数uv/百科页卡点击uv`
,
old_wiki_gc_uv
/
old_wiki_click_uv
as
`老用户在百科页卡good click 卡片数uv/百科页卡点击uv`
,
ios_ym_new_diary_gc_uv
/
ios_ym_new_diary_click_uv
as
`ios医美新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
nvl
(
round
(
ios_ym_new_diary_gc_uv
/
ios_ym_new_diary_click_uv
,
2
),
0
)
as
`ios医美新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
ios_ym_new_qa_gc_uv
/
ios_ym_new_qa_click_uv
as
`ios医美新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
nvl
(
round
(
ios_ym_new_qa_gc_uv
/
ios_ym_new_qa_click_uv
,
2
),
0
)
as
`ios医美新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,ios_ym_old_diary_gc_uv/ios_ym_old_diary_click_uv as `ios医美老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,ios_ym_old_diary_gc_uv/ios_ym_old_diary_click_uv as `ios医美老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,ios_ym_old_qa_gc_uv/ios_ym_old_qa_click_uv as `ios医美老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,ios_ym_old_qa_gc_uv/ios_ym_old_qa_click_uv as `ios医美老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
ios_ym_new_post_gc_uv
/
ios_ym_new_post_click_uv
as
`ios医美新在帖子页卡good click 卡片数uv/搜索帖子页结果页点击设备数uv`
,
'-'
as
`ios医美新在帖子页卡good click 卡片数uv/搜索帖子页结果页点击设备数uv`
,
ios_ym_new_wiki_gc_uv
/
ios_ym_new_wiki_click_uv
as
`ios医美新在百科页卡good click 卡片数uv/搜索百科页结果页点击设备数uv`
,
nvl
(
round
(
ios_ym_new_wiki_gc_uv
/
ios_ym_new_wiki_click_uv
,
2
),
0
)
as
`ios医美新在百科页卡good click 卡片数uv/搜索百科页结果页点击设备数uv`
,
andr_ym_new_diary_gc_uv
/
andr_ym_new_diary_click_uv
as
`android医美新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
nvl
(
round
(
andr_ym_new_diary_gc_uv
/
andr_ym_new_diary_click_uv
,
2
),
0
)
as
`android医美新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
andr_ym_new_qa_gc_uv
/
andr_ym_new_qa_click_uv
as
`android医美新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
nvl
(
round
(
andr_ym_new_qa_gc_uv
/
andr_ym_new_qa_click_uv
,
2
),
0
)
as
`android医美新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,andr_ym_old_diary_gc_uv/andr_ym_old_diary_click_uv as `android医美老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,andr_ym_old_diary_gc_uv/andr_ym_old_diary_click_uv as `android医美老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,andr_ym_old_qa_gc_uv/andr_ym_old_qa_click_uv as `android医美老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,andr_ym_old_qa_gc_uv/andr_ym_old_qa_click_uv as `android医美老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
ios_ai_new_diary_gc_uv
/
ios_ai_new_diary_click_uv
as
`iosAI新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
nvl
(
round
(
ios_ai_new_diary_gc_uv
/
ios_ai_new_diary_click_uv
,
2
),
0
)
as
`iosAI新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
ios_ai_new_qa_gc_uv
/
ios_ai_new_qa_click_uv
as
`iosAI新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
nvl
(
round
(
ios_ai_new_qa_gc_uv
/
ios_ai_new_qa_click_uv
,
2
),
0
)
as
`iosAI新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,ios_ai_old_diary_gc_uv/ios_ai_old_diary_click_uv as `iosAI老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,ios_ai_old_diary_gc_uv/ios_ai_old_diary_click_uv as `iosAI老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,ios_ai_old_qa_gc_uv/ios_ai_old_qa_click_uv as `iosAI老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,ios_ai_old_qa_gc_uv/ios_ai_old_qa_click_uv as `iosAI老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
andr_ai_new_diary_gc_uv
/
andr_ai_new_diary_click_uv
as
`android AI新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
nvl
(
round
(
andr_ai_new_diary_gc_uv
/
andr_ai_new_diary_click_uv
,
2
),
0
)
as
`android AI新在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
,
andr_ai_new_qa_gc_uv
/
andr_ai_new_qa_click_uv
as
`android AI新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
,
nvl
(
round
(
andr_ai_new_qa_gc_uv
/
andr_ai_new_qa_click_uv
,
2
),
0
)
as
`android AI新在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,andr_ai_old_diary_gc_uv/andr_ai_old_diary_click_uv as `android AI老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,andr_ai_old_diary_gc_uv/andr_ai_old_diary_click_uv as `android AI老在日记页卡good click 卡片数uv/搜索日记页结果页点击设备数uv`
-- ,andr_ai_old_qa_gc_uv/andr_ai_old_qa_click_uv as `android AI老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
-- ,andr_ai_old_qa_gc_uv/andr_ai_old_qa_click_uv as `android AI老在问答页卡good click 卡片数uv/搜索问答页结果页点击设备数uv`
...
@@ -110,11 +109,9 @@ FROM
...
@@ -110,11 +109,9 @@ FROM
LEFT
JOIN
LEFT
JOIN
(
SELECT
code
,
is_ai_channel
,
partition_day
(
SELECT
code
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
'${start_date}'
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
@@ -152,7 +149,7 @@ FROM
...
@@ -152,7 +149,7 @@ FROM
,
count
(
distinct
CASE
WHEN
page_name
=
'search_result_post'
THEN
array
(
params
[
'card_id'
])
END
)
as
post_click_pv
,
count
(
distinct
CASE
WHEN
page_name
=
'search_result_post'
THEN
array
(
params
[
'card_id'
])
END
)
as
post_click_pv
,
count
(
distinct
CASE
WHEN
page_name
=
'search_result_wiki'
THEN
array
(
params
[
'card_id'
])
END
)
as
wiki_click_pv
,
count
(
distinct
CASE
WHEN
page_name
=
'search_result_wiki'
THEN
array
(
params
[
'card_id'
])
END
)
as
wiki_click_pv
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
AND
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
((
action
=
'on_click_card'
AND
params
[
'card_content_type'
]
in
(
'answer'
,
'diary'
,
'question'
,
'qa'
,
AND
((
action
=
'on_click_card'
AND
params
[
'card_content_type'
]
in
(
'answer'
,
'diary'
,
'question'
,
'qa'
,
'wiki_collect'
,
'wiki_item'
,
'wiki_brand'
,
'wiki_material'
,
'wiki_drug'
,
'wiki_instrument'
))
'wiki_collect'
,
'wiki_item'
,
'wiki_brand'
,
'wiki_material'
,
'wiki_drug'
,
'wiki_instrument'
))
...
@@ -181,7 +178,7 @@ FROM
...
@@ -181,7 +178,7 @@ FROM
,
count
(
distinct
CASE
WHEN
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
and
referrer
=
'search_result_post'
THEN
time_str
END
)
as
post_click_pv
,
count
(
distinct
CASE
WHEN
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
and
referrer
=
'search_result_post'
THEN
time_str
END
)
as
post_click_pv
,
count
(
distinct
CASE
WHEN
page_name
in
(
'wiki_detail'
,
'wiki_collect'
,
'product_detail'
,
'wiki_brand'
)
THEN
time_str
end
)
as
wiki_click_pv
,
count
(
distinct
CASE
WHEN
page_name
in
(
'wiki_detail'
,
'wiki_collect'
,
'product_detail'
,
'wiki_brand'
)
THEN
time_str
end
)
as
wiki_click_pv
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_date
>=
'${start_date}'
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
referrer
in
(
'search_result_diary'
,
'search_result_question_answer'
,
'search_result_post'
,
'search_result_wiki'
)
AND
referrer
in
(
'search_result_diary'
,
'search_result_question_answer'
,
'search_result_post'
,
'search_result_wiki'
)
...
@@ -209,7 +206,7 @@ FROM
...
@@ -209,7 +206,7 @@ FROM
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
end
content_type
end
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
PARTITION_DATE
>=
'${start_date}'
and
(
referrer
in
(
'search_result_diary'
)
or
and
(
referrer
in
(
'search_result_diary'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_diary'
)))
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_diary'
)))
...
@@ -226,7 +223,7 @@ FROM
...
@@ -226,7 +223,7 @@ FROM
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
id
,
problem_id
,
user_id
,
reply_date
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
)
t1
JOIN
JOIN
...
@@ -245,7 +242,7 @@ FROM
...
@@ -245,7 +242,7 @@ FROM
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
FROM
online
.
tl_hdfs_api_tractate_reply_view
FROM
online
.
tl_hdfs_api_tractate_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
is_online
=
'true'
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
group
by
tractate_id
,
user_id
,
create_time
)
b
)
b
...
@@ -271,7 +268,7 @@ FROM
...
@@ -271,7 +268,7 @@ FROM
(
(
select
*
select
*
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
PARTITION_DATE
>=
'${start_date}'
and
(
referrer
in
(
'search_result_question_answer'
)
or
and
(
referrer
in
(
'search_result_question_answer'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_question_answer'
)))
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_question_answer'
)))
...
@@ -288,7 +285,7 @@ FROM
...
@@ -288,7 +285,7 @@ FROM
AND
answer_id
is
not
NULL
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
group
by
answer_id
,
user_id
,
create_time
group
by
answer_id
,
user_id
,
create_time
)
b
)
b
...
@@ -327,7 +324,7 @@ FROM
...
@@ -327,7 +324,7 @@ FROM
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
SELECT
tractate_id
as
content_id
,
'post'
as
type
,
user_id
,
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
as
create_date
FROM
online
.
tl_hdfs_api_tractate_reply_view
FROM
online
.
tl_hdfs_api_tractate_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
is_online
=
'true'
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
group
by
tractate_id
,
user_id
,
create_time
)
b
)
b
...
@@ -376,3 +373,4 @@ FROM
...
@@ -376,3 +373,4 @@ FROM
WHERE
t2
.
device_id
is
null
WHERE
t2
.
device_id
is
null
group
by
t1
.
partition_date
group
by
t1
.
partition_date
)
t
)
t
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