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
97dac580
Commit
97dac580
authored
Aug 18, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'yindanlei' into 'master'
add fangan_day report codes See merge request
!46
parents
b7a02afa
01460f46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
fangan_day.sql
pm/fangan_day/etl/fangan_day.sql
+5
-4
No files found.
pm/fangan_day/etl/fangan_day.sql
View file @
97dac580
...
@@ -9,7 +9,8 @@ SET role admin;
...
@@ -9,7 +9,8 @@ SET role admin;
ADD
JAR
hdfs
:
///
user
/
hive
/
share
/
lib
/
udf
/
hive
-
udf
-
1
.
0
-
SNAPSHOT
.
jar
;
ADD
JAR
hdfs
:
///
user
/
hive
/
share
/
lib
/
udf
/
hive
-
udf
-
1
.
0
-
SNAPSHOT
.
jar
;
CREATE
TEMPORARY
FUNCTION
convup
AS
'com.gmei.hive.common.udf.UDFConvUpgrade'
;
CREATE
TEMPORARY
FUNCTION
convup
AS
'com.gmei.hive.common.udf.UDFConvUpgrade'
;
--进制转换函数,支持各种进制转换
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
--哈希函数,支持MD2、MD5、SHA-1、SHA-256、SHA-384、SHA-512
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_fangan_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_fangan_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
...
@@ -46,9 +47,9 @@ FROM
...
@@ -46,9 +47,9 @@ FROM
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
device_id
,
device_os_type
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
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
device_type
WHEN
active_type
in
(
'1'
,
'2'
)
then
'新增'
END
as
device_type
,
CASE
WHEN
(
partition_date
>=
'20200725'
AND
partition_date
<=
'20200727'
AND
substr
(
convup
(
s
ha1
(
device_id
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
))
,
CASE
WHEN
(
partition_date
>=
'20200725'
AND
partition_date
<=
'20200727'
AND
substr
(
convup
(
s
etencryption
(
device_id
,
'sha-1'
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
))
or
(
partition_date
=
'20200724'
AND
substr
(
convup
(
s
ha1
(
device_id
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
,
'2'
,
'3'
,
'4'
))
or
(
partition_date
=
'20200724'
AND
substr
(
convup
(
s
etencryption
(
device_id
,
'sha-1'
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
,
'2'
,
'3'
,
'4'
))
or
(
partition_date
>=
'20200728'
AND
substr
(
convup
(
s
ha1
(
device_id
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
,
'2'
,
'3'
,
'4'
))
THEN
'测试组A(方案库)'
or
(
partition_date
>=
'20200728'
AND
substr
(
convup
(
s
etencryption
(
device_id
,
'sha-1'
),
16
,
10
),
-
1
)
in
(
'0'
,
'1'
,
'2'
,
'3'
,
'4'
))
THEN
'测试组A(方案库)'
else
'测试组B(无方案库)'
END
as
grey_type
else
'测试组B(无方案库)'
END
as
grey_type
,
CASE
WHEN
is_ai_channel
=
'true'
THEN
'AI'
ELSE
'医美'
END
as
channel_type
,
CASE
WHEN
is_ai_channel
=
'true'
THEN
'AI'
ELSE
'医美'
END
as
channel_type
FROM
online
.
ml_device_day_active_status
FROM
online
.
ml_device_day_active_status
...
...
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