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
5554b5f2
Commit
5554b5f2
authored
Nov 13, 2020
by
edz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push core
parent
bcd363f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
33 deletions
+48
-33
ai_daily.sql
pm/core_daily/report/ai_daily.sql
+20
-12
home_daily.sql
pm/core_daily/report/home_daily.sql
+14
-9
search_daily.sql
pm/core_daily/report/search_daily.sql
+14
-12
No files found.
pm/core_daily/report/ai_daily.sql
View file @
5554b5f2
...
...
@@ -24,9 +24,11 @@ FROM
LEFT
JOIN
(
SELECT
code
,
is_spam
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
'${start_date}'
and
partition_day
<
'${end_date}'
)
tmp
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_day
<=
REGEXP_REPLACE
(
current_date
(),
'-'
,
''
))
tmp
on
first_channel_source_type
=
tmp
.
code
and
m
.
partition_date
=
tmp
.
partition_day
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
REGEXP_REPLACE
(
current_date
(),
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
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'
...
...
@@ -61,7 +63,8 @@ FROM
page_name
,
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
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
REGEXP_REPLACE
(
current_date
(),
'-'
,
''
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
action
=
'page_view'
GROUP
BY
partition_date
,
...
...
@@ -99,7 +102,8 @@ FROM
page_name
,
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
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
REGEXP_REPLACE
(
current_date
(),
'-'
,
''
)
AND
page_name
in
(
'face_scan'
,
'report_result'
,
'face_detect_result'
,
'face_simulator'
)
AND
action
=
'page_view'
GROUP
BY
partition_date
,
...
...
@@ -124,7 +128,7 @@ FROM
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
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
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'
)
and
(
referrer
in
(
'report_result'
,
'face_detect_result'
,
'float_tag_detail'
)
or
...
...
@@ -142,7 +146,7 @@ FROM
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
JOIN
...
...
@@ -166,7 +170,7 @@ FROM
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
answer_id
,
user_id
,
create_time
UNION
ALL
...
...
@@ -175,7 +179,7 @@ FROM
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
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
)
b
...
...
@@ -197,7 +201,8 @@ FROM
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
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
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'
)
--点击加车
or
action
=
'welfare_detail_click_message'
--点击私信
or
(
action
=
'on_click_button'
AND
page_name
=
'welfare_detail'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
))
--点击人工咨询+预约面诊
...
...
@@ -221,7 +226,8 @@ FROM
--在结果页的去别的功能以及视频面诊按钮
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
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'on_click_button'
and
params
[
'page_name'
]
in
(
'report_result'
,
'face_detect_result'
)
--测肤结果页点击完成、再测一次、扫脸、视频面诊
AND
params
[
'button_name'
]
in
(
'ai_function'
,
'video_interview'
,
'AI测肤质'
,
'视频面诊'
,
'AI测颜值'
)
...
...
@@ -233,7 +239,8 @@ FROM
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
where
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
((
action
=
'page_view'
and
page_stay
>=
20
)
or
(
action
=
'on_click_card'
and
params
[
'card_type'
]
=
'card'
))
and
page_name
in
(
'search_result_question_answer'
,
'topic_aggregation'
)
...
...
@@ -248,7 +255,8 @@ FROM
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
where
partition_date
>=
'${start_date}'
and
partition_date
<
'${end_date}'
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'on_click_button'
and
page_name
=
'float_tag_detail'
and
params
[
'button_name'
]
in
(
'consult'
,
'bargain'
,
'commodity_ranking'
)
...
...
pm/core_daily/report/home_daily.sql
View file @
5554b5f2
...
...
@@ -75,9 +75,11 @@ FROM
LEFT
JOIN
(
SELECT
code
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
'${start_date}'
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
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'
...
...
@@ -103,7 +105,8 @@ FROM
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
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'page_view'
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'
]
...
...
@@ -117,7 +120,8 @@ FROM
,
params
[
'card_id'
]
as
card_id
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'on_click_card'
and
page_name
=
'home'
and
params
[
'card_type'
]
=
'card'
...
...
@@ -133,7 +137,8 @@ FROM
,
params
[
'business_id'
]
as
card_id
,
count
(
distinct
array
(
params
[
'card_id'
],
app_session_id
))
as
click_pv
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
action
=
'page_view'
and
(
referrer
in
(
'home'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
...
...
@@ -155,7 +160,7 @@ FROM
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
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
(
referrer
=
'home'
or
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
=
'home'
))
...
...
@@ -173,7 +178,7 @@ FROM
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
JOIN
...
...
@@ -197,7 +202,7 @@ FROM
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
answer_id
,
user_id
,
create_time
UNION
ALL
...
...
@@ -206,7 +211,7 @@ FROM
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
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
)
b
...
...
pm/core_daily/report/search_daily.sql
View file @
5554b5f2
...
...
@@ -109,9 +109,11 @@ FROM
LEFT
JOIN
(
SELECT
code
,
is_ai_channel
,
partition_day
FROM
DIM
.
DIM_AI_CHANNEL_ZP_NEW
WHERE
partition_day
>=
'${start_date}'
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
))
tmp
ON
partition_date
=
tmp
.
partition_day
AND
first_channel_source_type
=
code
WHERE
partition_date
>=
'${start_date}'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
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'
...
...
@@ -149,7 +151,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_wiki'
THEN
array
(
params
[
'card_id'
])
END
)
as
wiki_click_pv
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'${start_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
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'
,
'wiki_collect'
,
'wiki_item'
,
'wiki_brand'
,
'wiki_material'
,
'wiki_drug'
,
'wiki_instrument'
))
...
...
@@ -178,7 +180,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
(
'wiki_detail'
,
'wiki_collect'
,
'product_detail'
,
'wiki_brand'
)
THEN
time_str
end
)
as
wiki_click_pv
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'${start_date}'
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'page_view'
AND
referrer
in
(
'search_result_diary'
,
'search_result_question_answer'
,
'search_result_post'
,
'search_result_wiki'
)
...
...
@@ -206,7 +208,7 @@ FROM
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
end
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
(
referrer
in
(
'search_result_diary'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_diary'
)))
...
...
@@ -223,7 +225,7 @@ FROM
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
id
,
problem_id
,
user_id
,
reply_date
)
t1
JOIN
...
...
@@ -242,7 +244,7 @@ FROM
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
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
)
b
...
...
@@ -268,7 +270,7 @@ FROM
(
select
*
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
(
referrer
in
(
'search_result_question_answer'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_question_answer'
)))
...
...
@@ -285,7 +287,7 @@ FROM
AND
answer_id
is
not
NULL
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
group
by
answer_id
,
user_id
,
create_time
)
b
...
...
@@ -312,7 +314,7 @@ FROM
select
*
,
case
when
page_name
in
(
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
)
THEN
'post'
end
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
(
referrer
in
(
'search_result_post'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_post'
)))
...
...
@@ -324,7 +326,7 @@ FROM
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
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
'${start_date}'
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
is_online
=
'true'
group
by
tractate_id
,
user_id
,
create_time
)
b
...
...
@@ -351,7 +353,7 @@ FROM
select
*
,
case
when
page_name
in
(
'wiki_detail'
,
'wiki_collect'
,
'product_detail'
,
'wiki_brand'
)
THEN
'wiki'
end
content_type
FROM
ONLINE
.
BL_HDFS_MAIDIAN_UPDATES
WHERE
PARTITION_DATE
>=
'${start_date}'
WHERE
PARTITION_DATE
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
and
(
referrer
in
(
'search_result_wiki'
)
or
(
params
[
'referrer_link'
]
like
'%[%'
and
json_split
(
params
[
'referrer_link'
])[
size
(
json_split
(
params
[
'referrer_link'
]))
-
1
]
in
(
'search_result_wiki'
)))
...
...
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