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
e6e2a254
Commit
e6e2a254
authored
Aug 17, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push codes
parent
8e3d449c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
573 additions
and
451 deletions
+573
-451
clue_daily.sql
pm/clue_daily/etl/clue_daily.sql
+550
-443
clue_daily.zip
pm/clue_daily/job/clue_daily.zip
+0
-0
step1_13.job
pm/clue_daily/job/step1_13.job
+4
-0
step1_4.job
pm/clue_daily/job/step1_4.job
+2
-2
clue_daily.sql
pm/clue_daily/report/clue_daily.sql
+3
-3
search_related.sql
pm/search_related/etl/search_related.sql
+14
-3
No files found.
pm/clue_daily/etl/clue_daily.sql
View file @
e6e2a254
SET
mapreduce
.
job
.
queuename
=
data
;
SET
mapreduce
.
job
.
queuename
=
data
;
SET
mapreduce
.
map
.
memory
.
mb
=
8192
;
SET
mapreduce
.
map
.
java
.
opts
=-
Xmx8000m
;
SET
mapreduce
.
reduce
.
memory
.
mb
=
8192
;
SET
mapreduce
.
reduce
.
java
.
opts
=-
Xmx8000m
;
set
hive
.
auto
.
convert
.
join
=
true
;
SET
mapred
.
reduce
.
tasks
=
20
;
SET
role
admin
;
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'
;
CREATE
TEMPORARY
FUNCTION
setencryption
AS
'com.gmei.hive.common.udf.UDFStringSetEncryption'
;
SELECT
mas
.
partition_date
as
day_id
INSERT
OVERWRITE
TABLE
pm
.
tl_pm_userclue_d
PARTITION
(
PARTITION_DAY
=
${
partition_day
}
)
SELECT
T1
.
partition_date
as
day_id
,
T1
.
device_os_type
,
T1
.
active_type
,
T1
.
grey_type
,
dau
,
user_num
,
msg_dev
,
msg_num
,
valid_msg_dev
,
valid_msg_num
,
clue_dev
,
clue_num
,
call_dev
,
call_num
,
valid_call_dev
,
valid_call_num
,
msg_dev_4
,
msg_num_4
,
valid_msg_dev_4
,
valid_msg_num_4
,
clue_dev_4
,
clue_num_4
,
call_dev_4
,
call_num_4
,
valid_call_dev_4
,
valid_call_num_4
,
msg_dev_kyc
,
msg_num_kyc
,
valid_msg_dev_kyc
,
valid_msg_num_kyc
,
clue_dev_kyc
,
clue_num_kyc
,
call_dev_kyc
,
call_num_kyc
,
valid_call_dev_kyc
,
valid_call_num_kyc
,
msg_dev_qa
,
msg_num_qa
,
valid_msg_dev_qa
,
valid_msg_num_qa
,
clue_dev_qa
,
clue_num_qa
,
call_dev_qa
,
call_num_qa
,
valid_call_dev_qa
,
valid_call_num_qa
FROM
(
SELECT
mas
.
partition_date
as
partition_date
,
device_os_type
,
device_os_type
,
active_type
,
active_type
,
grey_type
,
grey_type
,
nvl
(
count
(
distinct
mas
.
device_id
),
0
)
as
dau
,
count
(
distinct
mas
.
device_id
)
as
dau
,
nvl
(
count
(
distinct
a
.
user_id
),
0
)
as
user_num
,
count
(
distinct
a
.
user_id
)
as
user_num
,
nvl
(
count
(
distinct
case
when
t1
.
msg_num
>
0
then
t1
.
user_id
end
),
0
)
msg_dev
,
count
(
distinct
case
when
t1
.
msg_num
>
0
then
t1
.
user_id
end
)
msg_dev
,
nvl
(
sum
(
t1
.
msg_num
),
0
)
msg_num
,
sum
(
t1
.
msg_num
)
msg_num
,
nvl
(
count
(
distinct
case
when
t1_v
.
valid_msg_num
>
0
then
t1_v
.
user_id
end
),
0
)
valid_msg_dev
,
count
(
distinct
case
when
t1_v
.
valid_msg_num
>
0
then
t1_v
.
user_id
end
)
valid_msg_dev
,
nvl
(
sum
(
t1_v
.
valid_msg_num
),
0
)
valid_msg_num
,
sum
(
t1_v
.
valid_msg_num
)
as
valid_msg_num
,
nvl
(
count
(
distinct
case
when
t2
.
clue_num
>
0
then
t2
.
user_id
end
),
0
)
clue_dev
,
count
(
distinct
case
when
t2
.
clue_num
>
0
then
t2
.
user_id
end
)
as
clue_dev
,
nvl
(
sum
(
t2
.
clue_num
),
0
)
as
clue_num
,
sum
(
t2
.
clue_num
)
as
clue_num
,
nvl
(
count
(
distinct
case
when
t3
.
call_num
>
0
then
t3
.
user_id
end
),
0
)
call_dev
,
nvl
(
sum
(
t3
.
call_num
),
0
)
call_num
,
nvl
(
count
(
distinct
case
when
t3_v
.
valid_call_num
>
0
then
t3_v
.
user_id
end
),
0
)
valid_call_dev
,
nvl
(
sum
(
t3_v
.
valid_call_num
),
0
)
valid_call_num
,
nvl
(
count
(
distinct
case
when
t10
.
msg_num
>
0
then
t10
.
user_id
end
),
0
)
msg_dev_4
,
nvl
(
sum
(
t10
.
msg_num
),
0
)
msg_num_4
,
nvl
(
count
(
distinct
case
when
t10_v
.
valid_msg_num
>
0
then
t10_v
.
user_id
end
),
0
)
valid_msg_dev_4
,
nvl
(
sum
(
t10_v
.
valid_msg_num
),
0
)
as
valid_msg_num_4
,
nvl
(
count
(
distinct
case
when
t11
.
clue_num
>
0
then
t11
.
user_id
end
),
0
)
as
clue_dev_4
,
nvl
(
sum
(
t11
.
clue_num
),
0
)
as
clue_num_4
,
nvl
(
count
(
distinct
case
when
t12
.
call_num
>
0
then
t12
.
user_id
end
),
0
)
as
call_dev_4
,
nvl
(
sum
(
t12
.
call_num
),
0
)
as
call_num_4
,
nvl
(
count
(
distinct
case
when
t12_v
.
valid_call_num
>
0
then
t12_v
.
user_id
end
),
0
)
as
valid_call_dev_4
,
nvl
(
sum
(
t12_v
.
valid_call_num
),
0
)
as
valid_call_num_4
,
nvl
(
count
(
distinct
case
when
t4
.
msg_num
>
0
then
t4
.
user_id
end
),
0
)
msg_dev_kyc
,
count
(
distinct
case
when
t10
.
msg_num
>
0
then
t10
.
user_id
end
)
msg_dev_4
,
nvl
(
sum
(
t4
.
msg_num
),
0
)
msg_num_kyc
,
sum
(
t10
.
msg_num
)
msg_num_4
,
nvl
(
count
(
distinct
case
when
t4_v
.
valid_msg_num
>
0
then
t4_v
.
user_id
end
),
0
)
valid_msg_dev_kyc
,
count
(
distinct
case
when
t10_v
.
valid_msg_num
>
0
then
t10_v
.
user_id
end
)
valid_msg_dev_4
,
nvl
(
sum
(
t4_v
.
valid_msg_num
),
0
)
as
valid_msg_num_kyc
,
sum
(
t10_v
.
valid_msg_num
)
as
valid_msg_num_4
,
nvl
(
count
(
distinct
case
when
t5
.
clue_num
>
0
then
t5
.
user_id
end
),
0
)
as
clue_dev_kyc
,
count
(
distinct
case
when
t11
.
clue_num
>
0
then
t11
.
user_id
end
)
as
clue_dev_4
,
nvl
(
sum
(
t5
.
clue_num
),
0
)
as
clue_num_kyc
,
sum
(
t11
.
clue_num
)
as
clue_num_4
,
nvl
(
count
(
distinct
case
when
t6
.
call_num
>
0
then
t6
.
user_id
end
),
0
)
as
call_dev_kyc
,
nvl
(
sum
(
t6
.
call_num
),
0
)
as
call_num_kyc
,
nvl
(
count
(
distinct
case
when
t6_v
.
valid_call_num
>
0
then
t6_v
.
user_id
end
),
0
)
as
valid_call_dev_kyc
,
nvl
(
sum
(
t6_v
.
valid_call_num
),
0
)
as
valid_call_num_kyc
,
nvl
(
count
(
distinct
case
when
t7
.
msg_num
>
0
then
t7
.
user_id
end
),
0
)
msg_dev_qa
,
nvl
(
sum
(
t7
.
msg_num
),
0
)
msg_num_qa
,
nvl
(
count
(
distinct
case
when
t7_v
.
valid_msg_num
>
0
then
t7_v
.
user_id
end
),
0
)
valid_msg_dev_qa
,
nvl
(
sum
(
t7_v
.
valid_msg_num
),
0
)
as
valid_msg_num_qa
,
nvl
(
count
(
distinct
case
when
t8
.
clue_num
>
0
then
t8
.
user_id
end
),
0
)
as
clue_dev_qa
,
nvl
(
sum
(
t8
.
clue_num
),
0
)
as
clue_num_qa
,
nvl
(
count
(
distinct
case
when
t9
.
call_num
>
0
then
t9
.
user_id
end
),
0
)
as
call_dev_qa
,
nvl
(
sum
(
t9
.
call_num
),
0
)
as
call_num_qa
,
nvl
(
count
(
distinct
case
when
t9_v
.
valid_call_num
>
0
then
t9_v
.
user_id
end
),
0
)
as
valid_call_dev_qa
,
nvl
(
sum
(
t9_v
.
valid_call_num
),
0
)
as
valid_call_num_qa
FROM
,
count
(
distinct
case
when
t4
.
msg_num
>
0
then
t4
.
user_id
end
)
msg_dev_kyc
(
,
sum
(
t4
.
msg_num
)
msg_num_kyc
,
count
(
distinct
case
when
t4_v
.
valid_msg_num
>
0
then
t4_v
.
user_id
end
)
valid_msg_dev_kyc
,
sum
(
t4_v
.
valid_msg_num
)
as
valid_msg_num_kyc
,
count
(
distinct
case
when
t5
.
clue_num
>
0
then
t5
.
user_id
end
)
as
clue_dev_kyc
,
sum
(
t5
.
clue_num
)
as
clue_num_kyc
,
count
(
distinct
case
when
t7
.
msg_num
>
0
then
t7
.
user_id
end
)
msg_dev_qa
,
sum
(
t7
.
msg_num
)
msg_num_qa
,
count
(
distinct
case
when
t7_v
.
valid_msg_num
>
0
then
t7_v
.
user_id
end
)
valid_msg_dev_qa
,
sum
(
t7_v
.
valid_msg_num
)
as
valid_msg_num_qa
,
count
(
distinct
case
when
t8
.
clue_num
>
0
then
t8
.
user_id
end
)
as
clue_dev_qa
,
sum
(
t8
.
clue_num
)
as
clue_num_qa
FROM
(
SELECT
partition_date
,
device_id
,
device_os_type
,
active_type
,
b
.
grey_type
SELECT
partition_date
,
device_id
,
device_os_type
,
active_type
,
b
.
grey_type
FROM
FROM
(
(
...
@@ -76,18 +120,18 @@ FROM
...
@@ -76,18 +120,18 @@ FROM
and
device_id
is
not
null
and
device_id
is
not
null
)
a
)
a
LATERAL
VIEW
explode
(
a
.
grey_type
)
b
AS
grey_type
LATERAL
VIEW
explode
(
a
.
grey_type
)
b
AS
grey_type
)
mas
)
mas
left
join
left
join
(
--找出user_id当天活跃的第一个设备id
(
--找出user_id当天活跃的第一个设备id
SELECT
user_id
,
partition_date
,
SELECT
user_id
,
partition_day
,
if
(
size
(
device_list
)
>
0
,
device
_list
[
0
],
''
)
AS
device_id
if
(
size
(
device_id_list
)
>
0
,
device_id
_list
[
0
],
''
)
AS
device_id
FROM
online
.
ml_user_updates
FROM
ml
.
ml_c_ct_ui_user_dimen_inc_d
WHERE
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
)
a
on
mas
.
partition_date
=
a
.
partition_date
and
mas
.
device_id
=
a
.
device_id
on
mas
.
partition_date
=
a
.
partition_day
and
mas
.
device_id
=
a
.
device_id
left
join
left
join
(
--私信线索总数
(
--私信线索总数
SELECT
msg
.
partition_date
,
user_id
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
FROM
...
@@ -99,26 +143,26 @@ left join
...
@@ -99,26 +143,26 @@ left join
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
)
msg
GROUP
BY
msg
.
partition_date
,
user_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t1
)
t1
ON
a
.
partition_date
=
t1
.
partition_date
and
a
.
user_id
=
t1
.
user_id
ON
a
.
partition_day
=
t1
.
partition_date
and
a
.
user_id
=
t1
.
user_id
left
join
left
join
(
--有效私信线索总数
(
--有效私信线索总数
SELECT
msg
.
partition_date
,
user_id
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
FROM
(
(
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
is_valid
=
'true'
and
is_valid
=
'true'
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
)
msg
GROUP
BY
msg
.
partition_date
,
user_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t1_v
)
t1_v
ON
a
.
partition_date
=
t1_v
.
partition_date
and
a
.
user_id
=
t1_v
.
user_id
ON
a
.
partition_day
=
t1_v
.
partition_date
and
a
.
user_id
=
t1_v
.
user_id
LEFT
JOIN
LEFT
JOIN
(
--电话线索总数
(
--电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
AS
clue_num
SELECT
partition_date
,
user_id
,
count
(
1
)
AS
clue_num
FROM
FROM
(
(
...
@@ -130,115 +174,11 @@ LEFT JOIN
...
@@ -130,115 +174,11 @@ LEFT JOIN
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
)
a
)
a
GROUP
BY
partition_date
,
user_id
GROUP
BY
partition_date
,
user_id
)
t2
)
t2
ON
a
.
partition_date
=
t2
.
partition_date
and
a
.
user_id
=
t2
.
user_id
ON
a
.
partition_day
=
t2
.
partition_date
and
a
.
user_id
=
t2
.
user_id
LEFT
JOIN
(
---拨打电话线索
left
join
SELECT
partition_date
,
user_id
(
--kyc私信
,
count
(
1
)
as
call_num
FROM
(
SELECT
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
AS
CALL_MONTH
,
MIN
(
partition_date
)
as
partition_date
,
1
as
call_num
FROM
(
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
start_time
>
call_time
)
a
LEFT
JOIN
(
SELECT
id
,
sub_id
FROM
tl
.
tl_gm_sl_ali_virtual_phone_binding
--阿里记录表
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
b
ON
a
.
sub_id
=
b
.
sub_id
LEFT
JOIN
(
SELECT
id
,
platform_binding_id
FROM
tl
.
tl_gm_sl_virtual_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
c
ON
b
.
id
=
c
.
platform_binding_id
LEFT
JOIN
(
SELECT
phone_binding_id
,
lead_task_id
FROM
tl
.
tl_gm_sl_lead_task_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
d
ON
c
.
id
=
d
.
phone_binding_id
JOIN
(
SELECT
id
,
user_id
,
merchant_id
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
)
e
ON
d
.
lead_task_id
=
e
.
id
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
GROUP
BY
user_id
,
partition_date
)
t3
ON
a
.
partition_date
=
t3
.
partition_date
and
a
.
user_id
=
t3
.
user_id
LEFT
JOIN
(
---拨打电话线索
SELECT
partition_date
,
user_id
,
count
(
1
)
as
valid_call_num
FROM
(
SELECT
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
AS
CALL_MONTH
,
MIN
(
partition_date
)
as
partition_date
,
1
as
call_num
FROM
(
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
start_time
>
call_time
and
unix_timestamp
(
substr
(
start_time
,
1
,
19
))
+
30
<=
unix_timestamp
(
substr
(
release_time
,
1
,
19
))
)
a
LEFT
JOIN
(
SELECT
id
,
sub_id
FROM
tl
.
tl_gm_sl_ali_virtual_phone_binding
--阿里记录表
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
b
ON
a
.
sub_id
=
b
.
sub_id
LEFT
JOIN
(
SELECT
id
,
platform_binding_id
FROM
tl
.
tl_gm_sl_virtual_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
c
ON
b
.
id
=
c
.
platform_binding_id
LEFT
JOIN
(
SELECT
phone_binding_id
,
lead_task_id
FROM
tl
.
tl_gm_sl_lead_task_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
d
ON
c
.
id
=
d
.
phone_binding_id
JOIN
(
SELECT
id
,
user_id
,
merchant_id
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
)
e
ON
d
.
lead_task_id
=
e
.
id
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
GROUP
BY
user_id
,
partition_date
)
t3_v
ON
a
.
partition_date
=
t3_v
.
partition_date
and
a
.
user_id
=
t3_v
.
user_id
left
join
(
--kyc私信
SELECT
msg
.
partition_date
,
user_id
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
FROM
...
@@ -257,7 +197,7 @@ left join
...
@@ -257,7 +197,7 @@ left join
(
(
SELECT
user_id
,
merchant_id
,
conversation_id
,
partition_day
SELECT
user_id
,
merchant_id
,
conversation_id
,
partition_day
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
GROUP
BY
user_id
,
merchant_id
,
conversation_id
,
partition_day
GROUP
BY
user_id
,
merchant_id
,
conversation_id
,
partition_day
)
b
)
b
...
@@ -265,10 +205,10 @@ left join
...
@@ -265,10 +205,10 @@ left join
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
)
msg
group
by
msg
.
partition_date
,
user_id
group
by
msg
.
partition_date
,
user_id
)
t4
)
t4
on
a
.
partition_date
=
t4
.
partition_date
and
a
.
user_id
=
t4
.
user_id
on
a
.
partition_day
=
t4
.
partition_date
and
a
.
user_id
=
t4
.
user_id
left
join
left
join
(
--kyc
私信
(
--kyc有效
私信
SELECT
msg
.
partition_date
,
user_id
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
FROM
...
@@ -296,10 +236,10 @@ left join
...
@@ -296,10 +236,10 @@ left join
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
)
msg
group
by
msg
.
partition_date
,
user_id
group
by
msg
.
partition_date
,
user_id
)
t4_v
)
t4_v
on
a
.
partition_date
=
t4_v
.
partition_date
and
a
.
user_id
=
t4_v
.
user_id
on
a
.
partition_day
=
t4_v
.
partition_date
and
a
.
user_id
=
t4_v
.
user_id
LEFT
JOIN
LEFT
JOIN
(
--kyc电话线索总数
(
--kyc电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
as
clue_num
SELECT
partition_date
,
user_id
,
count
(
1
)
as
clue_num
FROM
FROM
(
(
...
@@ -346,11 +286,403 @@ LEFT JOIN
...
@@ -346,11 +286,403 @@ LEFT JOIN
on
a
.
user_id
=
kyc
.
user_id
and
a
.
merchant_id
=
kyc
.
merchant_id
and
a
.
partition_date
=
kyc
.
partition_date
on
a
.
user_id
=
kyc
.
user_id
and
a
.
merchant_id
=
kyc
.
merchant_id
and
a
.
partition_date
=
kyc
.
partition_date
GROUP
BY
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
GROUP
BY
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
)
a
)
a
group
by
partition_date
,
user_id
group
by
partition_date
,
user_id
)
t5
)
t5
ON
a
.
partition_date
=
t5
.
partition_date
and
a
.
user_id
=
t5
.
user_id
ON
a
.
partition_day
=
t5
.
partition_date
and
a
.
user_id
=
t5
.
user_id
LEFT
JOIN
(
---拨打电话线索
left
join
(
--需求自测私信
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
as
month
,
min
(
partition_day
)
as
partition_date
FROM
(
SELECT
partition_date
,
user_id
,
merchant_id
from
(
--点击发送
SELECT
a
.
partition_date
,
user_id
,
cl_id
,
json_map
(
b
.
hospital_id
,
'string,string'
)[
'hospital_id'
]
hospital_id
FROM
(
SELECT
partition_date
,
user_id
,
cl_id
,
json_split
(
params
[
'hospital_id_list'
])
as
hospital_id_list
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
page_name
=
'ai_plan_consult_list'
and
params
[
'button_name'
]
in
(
'send'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
group
by
partition_date
,
user_id
,
cl_id
,
params
[
'hospital_id_list'
]
)
a
LATERAL
VIEW
EXPLODE
(
a
.
hospital_id_list
)
b
as
hospital_id
)
b
join
(
SELECT
hospital_id
,
merchant_id
FROM
online
.
ml_doctor_relation_dimen_day
WHERE
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
doctor_is_merchant
=
'true'
--医生是商户
GROUP
BY
hospital_id
,
merchant_id
)
c
on
c
.
hospital_id
=
b
.
hospital_id
group
by
partition_date
,
user_id
,
merchant_id
)
a
join
(
SELECT
user_id
,
merchant_id
,
partition_day
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
GROUP
BY
user_id
,
merchant_id
,
partition_day
)
b
on
a
.
user_id
=
b
.
user_id
and
a
.
merchant_id
=
b
.
merchant_id
and
a
.
partition_date
=
b
.
partition_day
group
by
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
)
msg
group
by
msg
.
partition_date
,
user_id
)
t7
on
a
.
partition_day
=
t7
.
partition_date
and
a
.
user_id
=
t7
.
user_id
left
join
(
--需求自测有效私信
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
as
month
,
min
(
partition_day
)
as
partition_date
FROM
(
SELECT
partition_date
,
user_id
,
merchant_id
from
(
--点击发送
SELECT
a
.
partition_date
,
user_id
,
cl_id
,
json_map
(
b
.
hospital_id
,
'string,string'
)[
'hospital_id'
]
hospital_id
FROM
(
SELECT
partition_date
,
user_id
,
cl_id
,
json_split
(
params
[
'hospital_id_list'
])
as
hospital_id_list
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
page_name
=
'ai_plan_consult_list'
and
params
[
'button_name'
]
in
(
'send'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
group
by
partition_date
,
user_id
,
cl_id
,
params
[
'hospital_id_list'
]
)
a
LATERAL
VIEW
EXPLODE
(
a
.
hospital_id_list
)
b
as
hospital_id
)
b
join
(
SELECT
hospital_id
,
merchant_id
FROM
online
.
ml_doctor_relation_dimen_day
WHERE
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
doctor_is_merchant
=
'true'
--医生是商户
GROUP
BY
hospital_id
,
merchant_id
)
c
on
c
.
hospital_id
=
b
.
hospital_id
group
by
partition_date
,
user_id
,
merchant_id
)
a
join
(
SELECT
user_id
,
merchant_id
,
partition_day
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
is_valid
=
'true'
GROUP
BY
user_id
,
merchant_id
,
partition_day
)
b
on
a
.
user_id
=
b
.
user_id
and
a
.
merchant_id
=
b
.
merchant_id
and
a
.
partition_date
=
b
.
partition_day
group
by
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
)
msg
group
by
msg
.
partition_date
,
user_id
)
t7_v
on
a
.
partition_day
=
t7_v
.
partition_date
and
a
.
user_id
=
t7_v
.
user_id
LEFT
JOIN
(
--需求自测电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
as
clue_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
as
month
,
min
(
a
.
partition_date
)
as
partition_date
FROM
(
SELECT
user_id
,
merchant_id
,
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
)
a
join
(
SELECT
partition_date
,
cl_id
,
user_id
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
params
[
'popup_name'
]
=
'bargain_phone'
and
page_name
=
'ai_plan_list'
and
params
[
'button_name'
]
in
(
'confirm'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
)
ai
on
a
.
user_id
=
ai
.
user_id
and
a
.
partition_date
=
ai
.
partition_date
GROUP
BY
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
)
a
group
by
partition_date
,
user_id
)
t8
ON
a
.
partition_day
=
t8
.
partition_date
and
a
.
user_id
=
t8
.
user_id
left
join
(
--t4以上商户私信线索总数
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
(
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
msg
.
merchant_id
=
b
.
merchant_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t10
ON
a
.
partition_day
=
t10
.
partition_date
and
a
.
user_id
=
t10
.
user_id
left
join
(
--t4以上商户有效私信线索总数
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
(
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
is_valid
=
'true'
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
msg
.
merchant_id
=
b
.
merchant_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t10_v
ON
a
.
partition_day
=
t10_v
.
partition_date
and
a
.
user_id
=
t10_v
.
user_id
left
join
(
--t4以上商户电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
AS
clue_num
FROM
(
SELECT
user_id
,
merchant_id
,
MIN
(
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
))
as
partition_date
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
AS
CALL_MONTH
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
)
a
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
a
.
merchant_id
=
b
.
merchant_id
GROUP
BY
partition_date
,
user_id
)
t11
ON
a
.
partition_day
=
t11
.
partition_date
and
a
.
user_id
=
t11
.
user_id
group
by
mas
.
partition_date
,
device_os_type
,
active_type
,
grey_type
)
T1
LEFT
JOIN
(
SELECT
t3
.
partition_date
,
a
.
device_os_type
,
'老活跃设备'
as
active_type
,
a
.
grey_type
,
count
(
distinct
case
when
t3
.
call_num
>
0
then
t3
.
user_id
end
)
as
call_dev
,
sum
(
t3
.
call_num
)
as
call_num
,
count
(
distinct
case
when
t3_v
.
valid_call_num
>
0
then
t3_v
.
user_id
end
)
as
valid_call_dev
,
sum
(
t3_v
.
valid_call_num
)
as
valid_call_num
,
count
(
distinct
case
when
t12
.
call_num
>
0
then
t12
.
user_id
end
)
as
call_dev_4
,
sum
(
t12
.
call_num
)
as
call_num_4
,
count
(
distinct
case
when
t12_v
.
valid_call_num
>
0
then
t12_v
.
user_id
end
)
as
valid_call_dev_4
,
sum
(
t12_v
.
valid_call_num
)
as
valid_call_num_4
,
count
(
distinct
case
when
t6
.
call_num
>
0
then
t6
.
user_id
end
)
as
call_dev_kyc
,
sum
(
t6
.
call_num
)
as
call_num_kyc
,
count
(
distinct
case
when
t6_v
.
valid_call_num
>
0
then
t6_v
.
user_id
end
)
as
valid_call_dev_kyc
,
sum
(
t6_v
.
valid_call_num
)
as
valid_call_num_kyc
,
count
(
distinct
case
when
t9
.
call_num
>
0
then
t9
.
user_id
end
)
as
call_dev_qa
,
sum
(
t9
.
call_num
)
as
call_num_qa
,
count
(
distinct
case
when
t9_v
.
valid_call_num
>
0
then
t9_v
.
user_id
end
)
as
valid_call_dev_qa
,
sum
(
t9_v
.
valid_call_num
)
as
valid_call_num_qa
FROM
(
SELECT
device_id
,
device_os_type
,
user_id
,
v
.
grey_type
FROM
(
SELECT
device_id
,
device_os_type
,
user_id
,
array
(
case
when
substr
(
convup
(
setencryption
(
device_id
,
'sha-1'
),
16
,
10
),
-
2
,
2
)
%
20
=
0
then
'kyc灰度'
else
'非灰'
end
,
'合计'
)
as
grey_type
FROM
(
SELECT
device_id
,
device_os_type
,
a
.
user_id
,
row_number
()
over
(
partition
by
device_id
order
by
a
.
partition_day
desc
)
as
rn
FROM
(
SELECT
device_id
,
device_os_type
,
v
.
user_id
,
partition_day
FROM
ml
.
mid_ml_c_ct_dv_device_inc_d
LATERAL
VIEW
EXPLODE
(
user_id_list
)
v
as
user_id
where
partition_day
>=
'20200801'
and
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
)
a
--由于要取近期该设备用过的user_id,故时间取的较长,避免用公式而将月末数据少算
join
(
SELECT
partition_day
,
user_id
FROM
ml
.
ml_c_ct_ui_user_dimen_inc_d
where
partition_day
>=
'20200801'
and
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
size
(
user_phone_list
)
>
0
group
by
partition_day
,
user_id
)
b
on
a
.
partition_day
=
b
.
partition_day
and
a
.
user_id
=
b
.
user_id
)
c
where
rn
=
1
)
d
LATERAL
VIEW
EXPLODE
(
d
.
grey_type
)
v
as
grey_type
)
a
JOIN
(
---拨打电话线索
SELECT
partition_date
,
user_id
,
count
(
1
)
as
call_num
FROM
(
SELECT
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
AS
CALL_MONTH
,
MIN
(
partition_date
)
as
partition_date
,
1
as
call_num
FROM
(
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
start_time
>
call_time
)
a
LEFT
JOIN
(
SELECT
id
,
sub_id
FROM
tl
.
tl_gm_sl_ali_virtual_phone_binding
--阿里记录表
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
b
ON
a
.
sub_id
=
b
.
sub_id
LEFT
JOIN
(
SELECT
id
,
platform_binding_id
FROM
tl
.
tl_gm_sl_virtual_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
c
ON
b
.
id
=
c
.
platform_binding_id
LEFT
JOIN
(
SELECT
phone_binding_id
,
lead_task_id
FROM
tl
.
tl_gm_sl_lead_task_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
d
ON
c
.
id
=
d
.
phone_binding_id
JOIN
(
SELECT
id
,
user_id
,
merchant_id
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
)
e
ON
d
.
lead_task_id
=
e
.
id
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
GROUP
BY
user_id
,
partition_date
)
t3
ON
a
.
user_id
=
t3
.
user_id
LEFT
JOIN
(
---拨打电话线索
SELECT
partition_date
,
user_id
,
count
(
1
)
as
valid_call_num
FROM
(
SELECT
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
AS
CALL_MONTH
,
MIN
(
partition_date
)
as
partition_date
,
1
as
call_num
FROM
(
SELECT
sub_id
,
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_ali_virtual_phone_call_detail
--通话记录表,call_type呼叫类型
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
REGEXP_REPLACE
(
SUBSTR
(
call_time
,
0
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
start_time
>
call_time
and
unix_timestamp
(
substr
(
start_time
,
1
,
19
))
+
30
<=
unix_timestamp
(
substr
(
release_time
,
1
,
19
))
)
a
LEFT
JOIN
(
SELECT
id
,
sub_id
FROM
tl
.
tl_gm_sl_ali_virtual_phone_binding
--阿里记录表
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
b
ON
a
.
sub_id
=
b
.
sub_id
LEFT
JOIN
(
SELECT
id
,
platform_binding_id
FROM
tl
.
tl_gm_sl_virtual_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
c
ON
b
.
id
=
c
.
platform_binding_id
LEFT
JOIN
(
SELECT
phone_binding_id
,
lead_task_id
FROM
tl
.
tl_gm_sl_lead_task_phone_binding
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
d
ON
c
.
id
=
d
.
phone_binding_id
JOIN
(
SELECT
id
,
user_id
,
merchant_id
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
)
e
ON
d
.
lead_task_id
=
e
.
id
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
GROUP
BY
user_id
,
partition_date
)
t3_v
ON
t3
.
partition_date
=
t3_v
.
partition_date
and
t3
.
user_id
=
t3_v
.
user_id
LEFT
JOIN
(
--拨打电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
call_num
,
count
(
1
)
as
call_num
FROM
FROM
...
@@ -432,10 +764,10 @@ LEFT JOIN
...
@@ -432,10 +764,10 @@ LEFT JOIN
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
)
t1
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t6
)
t6
ON
a
.
partition_date
=
t6
.
partition_date
and
a
.
user_id
=
t6
.
user_id
ON
t3
.
partition_date
=
t6
.
partition_date
and
t3
.
user_id
=
t6
.
user_id
LEFT
JOIN
LEFT
JOIN
(
---拨打电话线索
(
---拨打电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
valid_call_num
,
count
(
1
)
as
valid_call_num
FROM
FROM
...
@@ -518,150 +850,10 @@ LEFT JOIN
...
@@ -518,150 +850,10 @@ LEFT JOIN
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
)
t1
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t6_v
)
t6_v
ON
a
.
partition_date
=
t6_v
.
partition_date
and
a
.
user_id
=
t6_v
.
user_id
ON
t3
.
partition_date
=
t6_v
.
partition_date
and
t3
.
user_id
=
t6_v
.
user_id
left
join
LEFT
JOIN
(
--需求自测私信
(
---拨打电话线索
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
as
month
,
min
(
partition_day
)
as
partition_date
FROM
(
SELECT
partition_date
,
user_id
,
merchant_id
from
(
--点击发送
SELECT
a
.
partition_date
,
user_id
,
cl_id
,
json_map
(
b
.
hospital_id
,
'string,string'
)[
'hospital_id'
]
hospital_id
FROM
(
SELECT
partition_date
,
user_id
,
cl_id
,
json_split
(
params
[
'hospital_id_list'
])
as
hospital_id_list
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
page_name
=
'ai_plan_consult_list'
and
params
[
'button_name'
]
in
(
'send'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
group
by
partition_date
,
user_id
,
cl_id
,
params
[
'hospital_id_list'
]
)
a
LATERAL
VIEW
EXPLODE
(
a
.
hospital_id_list
)
b
as
hospital_id
)
b
join
(
SELECT
hospital_id
,
merchant_id
FROM
online
.
ml_doctor_relation_dimen_day
WHERE
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
doctor_is_merchant
=
'true'
--医生是商户
GROUP
BY
hospital_id
,
merchant_id
)
c
on
c
.
hospital_id
=
b
.
hospital_id
group
by
partition_date
,
user_id
,
merchant_id
)
a
join
(
SELECT
user_id
,
merchant_id
,
partition_day
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
GROUP
BY
user_id
,
merchant_id
,
partition_day
)
b
on
a
.
user_id
=
b
.
user_id
and
a
.
merchant_id
=
b
.
merchant_id
and
a
.
partition_date
=
b
.
partition_day
group
by
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
)
msg
group
by
msg
.
partition_date
,
user_id
)
t7
on
a
.
partition_date
=
t7
.
partition_date
and
a
.
user_id
=
t7
.
user_id
left
join
(
--需求自测私信
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
as
month
,
min
(
partition_day
)
as
partition_date
FROM
(
SELECT
partition_date
,
user_id
,
merchant_id
from
(
--点击发送
SELECT
a
.
partition_date
,
user_id
,
cl_id
,
json_map
(
b
.
hospital_id
,
'string,string'
)[
'hospital_id'
]
hospital_id
FROM
(
SELECT
partition_date
,
user_id
,
cl_id
,
json_split
(
params
[
'hospital_id_list'
])
as
hospital_id_list
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
page_name
=
'ai_plan_consult_list'
and
params
[
'button_name'
]
in
(
'send'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
group
by
partition_date
,
user_id
,
cl_id
,
params
[
'hospital_id_list'
]
)
a
LATERAL
VIEW
EXPLODE
(
a
.
hospital_id_list
)
b
as
hospital_id
)
b
join
(
SELECT
hospital_id
,
merchant_id
FROM
online
.
ml_doctor_relation_dimen_day
WHERE
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
AND
doctor_is_merchant
=
'true'
--医生是商户
GROUP
BY
hospital_id
,
merchant_id
)
c
on
c
.
hospital_id
=
b
.
hospital_id
group
by
partition_date
,
user_id
,
merchant_id
)
a
join
(
SELECT
user_id
,
merchant_id
,
partition_day
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
is_valid
=
'true'
GROUP
BY
user_id
,
merchant_id
,
partition_day
)
b
on
a
.
user_id
=
b
.
user_id
and
a
.
merchant_id
=
b
.
merchant_id
and
a
.
partition_date
=
b
.
partition_day
group
by
a
.
user_id
,
a
.
merchant_id
,
substr
(
partition_day
,
1
,
6
)
)
msg
group
by
msg
.
partition_date
,
user_id
)
t7_v
on
a
.
partition_date
=
t7_v
.
partition_date
and
a
.
user_id
=
t7_v
.
user_id
LEFT
JOIN
(
--需求自测电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
as
clue_num
FROM
(
SELECT
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
as
month
,
min
(
a
.
partition_date
)
as
partition_date
FROM
(
SELECT
user_id
,
merchant_id
,
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
as
partition_date
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
)
a
join
(
SELECT
partition_date
,
cl_id
,
user_id
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
params
[
'popup_name'
]
=
'bargain_phone'
and
page_name
=
'ai_plan_list'
and
params
[
'button_name'
]
in
(
'confirm'
)
and
action
=
'on_click_button'
and
int
(
split
(
app_version
,
'
\\
.'
)[
1
])
>=
31
)
ai
on
a
.
user_id
=
ai
.
user_id
and
a
.
partition_date
=
ai
.
partition_date
GROUP
BY
a
.
user_id
,
a
.
merchant_id
,
substr
(
a
.
partition_date
,
1
,
6
)
)
a
group
by
partition_date
,
user_id
)
t8
ON
a
.
partition_date
=
t8
.
partition_date
and
a
.
user_id
=
t8
.
user_id
LEFT
JOIN
(
---拨打电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
call_num
,
count
(
1
)
as
call_num
FROM
FROM
...
@@ -725,10 +917,10 @@ LEFT JOIN
...
@@ -725,10 +917,10 @@ LEFT JOIN
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
)
t1
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t9
)
t9
ON
a
.
partition_date
=
t9
.
partition_date
and
a
.
user_id
=
t9
.
user_id
ON
t3
.
partition_date
=
t9
.
partition_date
and
t3
.
user_id
=
t9
.
user_id
LEFT
JOIN
LEFT
JOIN
(
---拨打电话线索
(
---拨打电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
valid_call_num
,
count
(
1
)
as
valid_call_num
FROM
FROM
...
@@ -793,98 +985,10 @@ LEFT JOIN
...
@@ -793,98 +985,10 @@ LEFT JOIN
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
GROUP
BY
e
.
user_id
,
e
.
merchant_id
,
regexp_replace
(
SUBSTR
(
a
.
partition_date
,
1
,
6
),
'-'
,
''
)
)
t1
)
t1
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t9_v
)
t9_v
ON
a
.
partition_date
=
t9_v
.
partition_date
and
a
.
user_id
=
t9_v
.
user_id
ON
t3
.
partition_date
=
t9_v
.
partition_date
and
t3
.
user_id
=
t9_v
.
user_id
left
join
LEFT
JOIN
(
--t4以上商户私信线索总数
(
---拨打电话线索
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
msg_num
FROM
(
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
group
by
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
msg
.
merchant_id
=
b
.
merchant_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t10
ON
a
.
partition_date
=
t10
.
partition_date
and
a
.
user_id
=
t10
.
user_id
left
join
(
--有效私信线索总数
SELECT
msg
.
partition_date
,
user_id
,
count
(
msg
.
merchant_id
)
as
valid_msg_num
FROM
(
SELECT
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
AS
MONTH
,
min
(
partition_day
)
as
partition_date
FROM
ml
.
ml_c_et_msg_conversation_dimen_inc_d
--新仓库私信表
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
and
is_valid
=
'true'
GROUP
BY
user_id
,
merchant_id
,
SUBSTR
(
partition_day
,
1
,
6
)
)
msg
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
msg
.
merchant_id
=
b
.
merchant_id
GROUP
BY
msg
.
partition_date
,
user_id
)
t10_v
ON
a
.
partition_date
=
t10_v
.
partition_date
and
a
.
user_id
=
t10_v
.
user_id
left
join
(
--t4以上商户电话线索总数
SELECT
partition_date
,
user_id
,
count
(
1
)
AS
clue_num
FROM
(
SELECT
user_id
,
merchant_id
,
MIN
(
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
))
as
partition_date
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
AS
CALL_MONTH
FROM
tl
.
tl_gm_sl_lead_task
--线索任务表(用户点击授权后记入该表)
WHERE
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
1
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
AND
source
=
'2'
--用户行为电话授权
GROUP
BY
user_id
,
merchant_id
,
regexp_replace
(
SUBSTR
(
created_time
,
1
,
7
),
'-'
,
''
)
)
a
join
(
SELECT
distinct
merchant_id
FROM
(
SELECT
merchant_id
,
merchant_level
,
row_number
()
over
(
partition
by
merchant_id
order
by
data_month
desc
)
as
rn
FROM
online
.
al_business_merchant_grade_day_repo
where
partition_date
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
)
a
where
((
rn
=
1
and
merchant_level
>=
4
)
or
merchant_id
in
(
'6329571003697540960'
))
and
merchant_id
not
in
(
'6385685250516781117'
)
--去除和增加是为了和王妍的线索通数据保持一致
)
b
on
a
.
merchant_id
=
b
.
merchant_id
GROUP
BY
partition_date
,
user_id
)
t11
ON
a
.
partition_date
=
t11
.
partition_date
and
a
.
user_id
=
t11
.
user_id
LEFT
JOIN
(
---拨打电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
call_num
,
count
(
1
)
as
call_num
FROM
FROM
...
@@ -947,10 +1051,10 @@ LEFT JOIN
...
@@ -947,10 +1051,10 @@ LEFT JOIN
)
b
)
b
on
t1
.
merchant_id
=
b
.
merchant_id
on
t1
.
merchant_id
=
b
.
merchant_id
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t12
)
t12
ON
a
.
partition_date
=
t12
.
partition_date
and
a
.
user_id
=
t12
.
user_id
ON
t3
.
partition_date
=
t12
.
partition_date
and
t3
.
user_id
=
t12
.
user_id
LEFT
JOIN
LEFT
JOIN
(
---拨打有效电话线索
(
---拨打有效电话线索
SELECT
partition_date
,
user_id
SELECT
partition_date
,
user_id
,
count
(
1
)
as
valid_call_num
,
count
(
1
)
as
valid_call_num
FROM
FROM
...
@@ -1014,7 +1118,11 @@ LEFT JOIN
...
@@ -1014,7 +1118,11 @@ LEFT JOIN
)
b
)
b
on
t1
.
merchant_id
=
b
.
merchant_id
on
t1
.
merchant_id
=
b
.
merchant_id
GROUP
BY
user_id
,
partition_date
GROUP
BY
user_id
,
partition_date
)
t12_v
)
t12_v
ON
a
.
partition_date
=
t12_v
.
partition_date
and
a
.
user_id
=
t12_v
.
user_id
ON
t3
.
partition_date
=
t12_v
.
partition_date
and
t3
.
user_id
=
t12_v
.
user_id
group
by
mas
.
partition_date
,
device_os_type
,
active_type
,
grey_type
group
by
t3
.
partition_date
,
a
.
device_os_type
,
a
.
grey_type
order
by
mas
.
partition_date
desc
,
device_os_type
,
active_type
,
grey_type
)
T2
\ No newline at end of file
on
T1
.
partition_date
=
T2
.
partition_date
AND
T1
.
device_os_type
=
T2
.
device_os_type
AND
T1
.
active_type
=
T2
.
active_type
AND
T1
.
grey_type
=
T2
.
grey_type
;
pm/clue_daily/job/clue_daily.zip
View file @
e6e2a254
No preview for this file type
pm/clue_daily/job/step1_13.job
0 → 100644
View file @
e6e2a254
#step1_13.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive ml mid_ml_c_ct_dv_device_inc_d
\ No newline at end of file
pm/clue_daily/job/step1_4.job
View file @
e6e2a254
#step1_3.job
#step1_3.job
type=command
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_user_updates
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive ml ml_c_ct_ui_user_dimen_inc_d
\ No newline at end of file
\ No newline at end of file
pm/clue_daily/report/clue_daily.sql
View file @
e6e2a254
SELECT
mas
.
partition_date
`日期`
SELECT
day_id
`日期`
,
device_os_type
`系统`
,
device_os_type
`系统`
,
active_type
`新老`
,
active_type
`新老`
,
grey_type
`是否灰度`
,
grey_type
`是否灰度`
...
@@ -48,4 +48,5 @@ SELECT mas.partition_date `日期`
...
@@ -48,4 +48,5 @@ SELECT mas.partition_date `日期`
,
valid_call_dev_qa
as
`有效电话线索设备数-需求自测`
,
valid_call_dev_qa
as
`有效电话线索设备数-需求自测`
,
valid_call_num_qa
as
`有效电话线索人次-需求自测`
,
valid_call_num_qa
as
`有效电话线索人次-需求自测`
FROM
pm
.
tl_pm_userclue_d
FROM
pm
.
tl_pm_userclue_d
where
partition_day
=
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
)
where
partition_day
in
(
'20200901'
,
'202001001'
,
'20201101'
,
'20201201'
,
'20210101'
,
regexp_replace
(
date_sub
(
current_date
,
1
),
'-'
,
''
))
\ No newline at end of file
order
by
`日期`
,
`系统`
,
`新老`
,
`是否灰度`
pm/search_related/etl/search_related.sql
View file @
e6e2a254
...
@@ -33,7 +33,8 @@ FROM
...
@@ -33,7 +33,8 @@ FROM
and
page_name
in
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
and
page_name
in
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'内容详情页搜索框'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'内容详情页搜索框'
when
action
=
'详情页高亮词'
then
'详情页高亮词搜索'
when
action
=
'详情页高亮词'
then
'详情页高亮词搜索'
when
action
=
'大家都在看'
then
'首页feed大家都在看'
when
action
=
'新首页-大家都在看'
then
'新首页-大家都在看'
when
action
=
'旧首页-大家都在看'
then
'旧首页-大家都在看'
when
action
=
'热搜词'
then
'美购首页热搜词'
else
null
end
as
search_entrance
when
action
=
'热搜词'
then
'美购首页热搜词'
else
null
end
as
search_entrance
,
count
(
cl_id
)
as
search_pv
,
count
(
cl_id
)
as
search_pv
,
count
(
distinct
cl_id
)
as
search_uv
,
count
(
distinct
cl_id
)
as
search_uv
...
@@ -64,7 +65,7 @@ FROM
...
@@ -64,7 +65,7 @@ FROM
union
all
union
all
SELECT
partition_date
,
cl_id
,
null
as
page_name
,
'大家都在看'
as
action
,
null
as
referrer_link
SELECT
partition_date
,
cl_id
,
null
as
page_name
,
'
新首页-
大家都在看'
as
action
,
null
as
referrer_link
FROM
online
.
bl_hdfs_maidian_updates
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
where
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'on_click_card'
AND
action
=
'on_click_card'
...
@@ -73,6 +74,15 @@ FROM
...
@@ -73,6 +74,15 @@ FROM
AND
params
[
'card_type'
]
=
'search_word'
AND
params
[
'card_type'
]
=
'search_word'
--AND page_name='home' android的page_name为空
--AND page_name='home' android的page_name为空
union
all
SELECT
partition_date
,
cl_id
,
page_name
,
'旧首页-大家都在看'
as
action
,
null
as
referrer_link
FROM
online
.
bl_hdfs_maidian_updates
where
partition_date
>=
'20200801'
and
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
action
=
'do_search'
and
params
[
'input_type'
]
=
'everyone_watch'
and
params
[
'tab'
]
=
'精选'
and
page_name
=
'home'
union
all
union
all
SELECT
partition_date
,
cl_id
,
page_name
,
'热搜词'
as
action
,
null
as
referrer_link
SELECT
partition_date
,
cl_id
,
page_name
,
'热搜词'
as
action
,
null
as
referrer_link
...
@@ -104,7 +114,8 @@ FROM
...
@@ -104,7 +114,8 @@ FROM
and
page_name
in
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
and
page_name
in
(
'diary_detail'
,
'topic_detail'
,
'post_detail'
,
'user_post_detail'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'内容详情页搜索框'
,
'doctor_post_detail'
,
'question_detail'
,
'answer_detail'
,
'question_answer_detail'
)
then
'内容详情页搜索框'
when
action
=
'详情页高亮词'
then
'详情页高亮词搜索'
when
action
=
'详情页高亮词'
then
'详情页高亮词搜索'
when
action
=
'大家都在看'
then
'首页feed大家都在看'
when
action
=
'新首页-大家都在看'
then
'新首页-大家都在看'
when
action
=
'旧首页-大家都在看'
then
'旧首页-大家都在看'
when
action
=
'热搜词'
then
'美购首页热搜词'
else
null
end
when
action
=
'热搜词'
then
'美购首页热搜词'
else
null
end
having
search_entrance
is
not
null
having
search_entrance
is
not
null
)
t
)
t
...
...
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