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
b4eeda3f
Commit
b4eeda3f
authored
Aug 27, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push codes
parent
846c3e27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
1 deletion
+65
-1
daily_operation.sql
pm/daily_operation/etl/daily_operation.sql
+65
-1
No files found.
pm/daily_operation/etl/daily_operation.sql
View file @
b4eeda3f
...
@@ -13,6 +13,70 @@ ADD JAR hdfs:///user/hive/share/lib/udf/hive-udf-1.0-SNAPSHOT.jar;
...
@@ -13,6 +13,70 @@ ADD JAR hdfs:///user/hive/share/lib/udf/hive-udf-1.0-SNAPSHOT.jar;
CREATE
TEMPORARY
FUNCTION
convup
AS
'com.gmei.hive.common.udf.UDFConvUpgrade'
;
CREATE
TEMPORARY
FUNCTION
convup
AS
'com.gmei.hive.common.udf.UDFConvUpgrade'
;
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_channel_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
SELECT
a
.
partition_date
as
day_id
,
a
.
device_id
as
device_id
,
device_os_type
,
active_type
,
first_channel_source_type
,
first_city
FROM
(
SELECT
partition_date
,
device_os_type
,
device_id
,
first_channel_source_type
,
first_city
,
case
WHEN
active_type
=
'4'
THEN
'老活'
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增'
END
as
active_type
FROM
online
.
ml_device_day_active_status
where
partition_date
>=
'20200101'
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
\_
%'
)
a
LEFT
JOIN
(
SELECT
partition_date
,
cl_id
from
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'20200101'
AND
partition_date
<
regexp_replace
(
current_date
,
'-'
,
''
)
AND
action
=
'popup_view'
AND
params
[
'popup_name'
]
=
'service_privacy'
GROUP
BY
partition_date
,
cl_id
)
b
ON
a
.
device_id
=
b
.
cl_id
AND
a
.
partition_date
=
b
.
partition_date
LEFT
JOIN
(
SELECT
partition_date
,
cl_id
from
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'20200101'
AND
partition_date
<
regexp_replace
(
current_date
,
'-'
,
''
)
AND
action
=
'page_view'
GROUP
BY
partition_date
,
cl_id
)
c
ON
a
.
device_id
=
c
.
cl_id
AND
a
.
partition_date
=
c
.
partition_date
LEFT
JOIN
(
SELECT
partition_day
,
device_id
FROM
ml
.
ml_c_et_ck_click_dimen_d
where
partition_day
>=
'20200101'
AND
partition_day
<
regexp_replace
(
current_date
,
'-'
,
''
)
GROUP
BY
partition_day
,
device_id
)
d
on
a
.
device_id
=
d
.
device_id
AND
a
.
partition_date
=
d
.
partition_day
WHERE
b
.
cl_id
is
NOT
NULL
AND
c
.
cl_id
is
NULL
AND
d
.
device_id
is
NULL
GROUP
BY
a
.
partition_date
,
a
.
device_id
,
device_os_type
,
active_type
,
first_channel_source_type
,
first_city
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_operation_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_operation_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
...
@@ -1122,7 +1186,7 @@ LEFT JOIN
...
@@ -1122,7 +1186,7 @@ LEFT JOIN
(
(
SELECT
partition_date
,
registration_id
,
platform
,
mesid
SELECT
partition_date
,
registration_id
,
platform
,
mesid
FROM
online
.
tl_hdfs_auroracallback_view
--推送push的回调表
FROM
online
.
tl_hdfs_auroracallback_view
--推送push的回调表
where
partition_da
y
>=
regexp_replace
(
date_sub
(
current_date
,
30
),
'-'
,
''
)
and
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
where
partition_da
te
>=
regexp_replace
(
date_sub
(
current_date
,
30
),
'-'
,
''
)
and
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
--and notification_state='true'--用户开启通知
--and notification_state='true'--用户开启通知
and
callback_type
=
'0'
--送达回执
and
callback_type
=
'0'
--送达回执
and
platform
=
'android'
and
platform
=
'android'
...
...
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