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
f3a4c0fe
Commit
f3a4c0fe
authored
Jun 22, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
0356a45e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
319 additions
and
244 deletions
+319
-244
meigou-detail-page-dispense-pv.sql
...bak/meigou-detail-page/meigou-detail-page-dispense-pv.sql
+32
-32
daily_content_data_insert.sql
sqls/daily_content_data_insert/daily_content_data_insert.sql
+287
-212
create_daliy_content.sql
tables/daily_content/create_daliy_content.sql
+0
-0
create_recommend_daily_data.sql
.../daily_recommend_strategy/create_recommend_daily_data.sql
+0
-0
create_search_click_path.sql
tables/search_related/create_search_click_path.sql
+0
-0
create_search_input_type.sql
tables/search_related/create_search_input_type.sql
+0
-0
create_search_result_click_rate.sql
tables/search_related/create_search_result_click_rate.sql
+0
-0
No files found.
sqls/bak/meigou-detail-page/meigou-detail-page-dispense-pv.sql
View file @
f3a4c0fe
...
@@ -266,37 +266,37 @@ FROM
...
@@ -266,37 +266,37 @@ FROM
AND
page_name
=
'welfare_detail'
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
AND
action
=
'page_click_share'
)
click
)
click
JOIN
JOIN
(
(
SELECT
partition_date
SELECT
partition_date
,
device_os_type
AS
device_type
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
device_id
,
device_id
FROM
online
.
ml_device_day_active_status
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
LEFT
JOIN
(
SELECT
phone
,
time
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'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
\_
%'
)
mas
)
mas
ON
click
.
cl_id
=
mas
.
device_id
ON
click
.
cl_id
=
mas
.
device_id
AND
click
.
partition_date
=
mas
.
partition_date
AND
click
.
partition_date
=
mas
.
partition_date
)
t1
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T1
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/daily_content_data_insert/daily_content_data_insert.sql
View file @
f3a4c0fe
...
@@ -90,35 +90,40 @@ SELECT
...
@@ -90,35 +90,40 @@ SELECT
,
COALESCE
(
T3
.
article_stay
,
0
)
AS
article_stay
,
COALESCE
(
T3
.
article_stay
,
0
)
AS
article_stay
FROM
FROM
(
--基础维度/dau
(
--基础维度/dau
SELECT
partition_date
,
device_os_type
,
active_type
,
t2
.
channel
,
sum
(
dau
)
AS
dau
SELECT
partition_date
,
device_os_type
,
active_type
,
t2
.
channel
,
count
(
distinct
device_id
)
AS
dau
FROM
FROM
(
(
SELECT
partition_date
SELECT
partition_date
,
device_os_type
,
m
.
device_id
,
device_os_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
,
count
(
1
)
AS
dau
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
FROM
online
.
ml_device_day_active_status
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
LEFT
JOIN
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
pm
.
tl_pm_ydl
FROM
online
.
ml_device_day_active_status
m
WHERE
col3
=
'0204_danlei_channel'
)
tmp
LEFT
JOIN
on
first_channel_source_type
=
tmp
.
col1
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
on
first_channel_source_type
=
tmp
.
col1
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
LEFT
JOIN
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
(
SELECT
DISTINCT
device_id
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
AND
active_type
in
(
'1'
,
'2'
,
'4'
)
GROUP
BY
partition_date
,
device_os_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
and
first_channel_source_type
not
in
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
,
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
partition_date
,
device_os_type
,
active_type
,
t2
.
channel
GROUP
BY
partition_date
,
device_os_type
,
active_type
,
t2
.
channel
...
@@ -152,29 +157,38 @@ LEFT JOIN
...
@@ -152,29 +157,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
page_name
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
page_name
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
JOIN
JOIN
(
(
...
@@ -233,33 +247,40 @@ LEFT JOIN
...
@@ -233,33 +247,40 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
page_name
,
t2
.
page_stay
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
page_name
,
t2
.
page_stay
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
JOIN
JOIN
(
(
SELECT
partition_date
,
page_name
,
cl_id
,
page_stay
SELECT
partition_date
,
page_name
,
cl_id
,
page_stay
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
...
@@ -302,29 +323,38 @@ LEFT JOIN
...
@@ -302,29 +323,38 @@ LEFT JOIN
FROM
FROM
(
(
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
AS
partition_date
SELECT
,
device_os_type
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
JOIN
JOIN
...
@@ -381,29 +411,38 @@ LEFT JOIN
...
@@ -381,29 +411,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t3
.
use_duration
,
t3
.
open_times
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t3
.
use_duration
,
t3
.
open_times
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
JOIN
JOIN
...
@@ -481,29 +520,38 @@ LEFT JOIN
...
@@ -481,29 +520,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
referrer
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t2
.
referrer
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
LEFT
JOIN
LEFT
JOIN
...
@@ -604,29 +652,38 @@ LEFT JOIN
...
@@ -604,29 +652,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t3
.
id
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t3
.
id
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
LEFT
JOIN
LEFT
JOIN
...
@@ -787,29 +844,38 @@ LEFT JOIN
...
@@ -787,29 +844,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t3
.
id
,
t3
.
type
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t3
.
id
,
t3
.
type
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
LEFT
JOIN
LEFT
JOIN
...
@@ -972,29 +1038,38 @@ LEFT JOIN
...
@@ -972,29 +1038,38 @@ LEFT JOIN
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t3
.
page_name
,
t3
.
page_stay
SELECT
t1
.
partition_date
,
device_os_type
,
active_type
,
channel
,
t2
.
cl_id
,
t3
.
page_name
,
t3
.
page_stay
FROM
FROM
(
(
SELECT
partition_date
SELECT
,
device_os_type
partition_date
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
m
.
device_id
,
device_os_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
case
WHEN
active_type
=
'4'
THEN
'老活跃设备'
,
array
(
CASE
WHEN
tmp
.
col2
=
'AI'
or
(
partition_date
<
20200301
AND
first_channel_source_type
like
'promotion_toutiao_jy%'
)
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增设备'
END
as
active_type
,
device_id
,
array
(
CASE
WHEN
first_channel_source_type
like
'%xinyouxingkong%'
or
a
.
device_id
is
not
NULL
THEN
'可疑'
FROM
online
.
ml_device_day_active_status
WHEN
(
partition_date
>=
'20190601'
and
tmp
.
col2
=
'AI'
)
LEFT
JOIN
or
(
partition_date
<
'20200301'
AND
partition_date
>=
'20190601'
and
first_channel_source_type
like
'promotion_toutiao_jy%'
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
or
(
partition_date
>=
'20200601'
and
((
first_channel_source_type
like
'promotion_toutiao_jy%'
)
or
(
first_channel_source_type
like
'dyand%'
)
or
(
first_channel_source_type
like
'douyin%'
)))
FROM
pm
.
tl_pm_ydl
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
WHERE
col3
=
'0204_danlei_channel'
)
tmp
FROM
online
.
ml_device_day_active_status
m
on
first_channel_source_type
=
tmp
.
col1
LEFT
JOIN
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
(
SELECT
col1
,
col2
--col1:子渠道,col2:是否属于AI,col3:标识
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
FROM
pm
.
tl_pm_ydl
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
WHERE
col3
=
'0204_danlei_channel'
)
tmp
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
on
first_channel_source_type
=
tmp
.
col1
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
LEFT
JOIN
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
(
SELECT
DISTINCT
device_id
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
FROM
al
.
al_pm_ct_dv_deviceappversionrollbackfrom20200101_d
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
WHERE
partition_day
=
regexp_replace
(
DATE_SUB
(
current_date
,
2
)
,
'-'
,
''
))
a
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
ON
m
.
device_id
=
a
.
device_id
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
where
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
60
)
,
'-'
,
''
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown'
)
AND
first_channel_source_type
not
like
'promotion
\_
jf
\_
%'
)
t1
)
t1
JOIN
JOIN
...
...
tables/create_daliy_content.sql
→
tables/
daily_content/
create_daliy_content.sql
View file @
f3a4c0fe
File moved
tables/create_recommend_daily_data.sql
→
tables/
daily_recommend_strategy/
create_recommend_daily_data.sql
View file @
f3a4c0fe
File moved
tables/create_search_click_path.sql
→
tables/
search_related/
create_search_click_path.sql
View file @
f3a4c0fe
File moved
tables/create_search_input_type.sql
→
tables/
search_related/
create_search_input_type.sql
View file @
f3a4c0fe
File moved
tables/create_search_result_click_rate.sql
→
tables/
search_related/
create_search_result_click_rate.sql
View file @
f3a4c0fe
File moved
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