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
7bb537bf
Commit
7bb537bf
authored
Oct 20, 2020
by
魏艺敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'weiyimin' into 'master'
push codes See merge request
!87
parents
44141d2e
464822c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
31 deletions
+35
-31
daily_reply_content.sql
pm/daily_reply_content/report/daily_reply_content.sql
+35
-31
No files found.
pm/daily_reply_content/report/daily_reply_content.sql
View file @
7bb537bf
...
...
@@ -4,14 +4,15 @@ select a.*
FROM
(
--有评论过日记帖的设备,排除疑似广告
SELECT
diary_
id
as
content_id
,
'日记贴'
as
type
,
user_id
,
create_time
,
content
SELECT
t1
.
id
as
content_id
,
'日记贴'
as
type
,
user_id
,
create_time
,
content
FROM
(
SELECT
id
,
problem_id
,
user_id
,
reply_date
as
create_time
,
content
FROM
online
.
tl_hdfs_topicreply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
>=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
is_online
=
'true'
and
regexp_replace
(
substr
(
reply_date
,
1
,
10
),
'-'
,
''
)
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
id
,
problem_id
,
user_id
,
reply_date
,
content
)
t1
JOIN
...
...
@@ -22,57 +23,60 @@ FROM
group
by
id
,
diary_id
)
t2
on
t2
.
id
=
t1
.
problem_id
group
by
diary_
id
,
user_id
,
create_time
,
content
group
by
t1
.
id
,
user_id
,
create_time
,
content
UNION
ALL
--有评论过回答的设备,排除疑似广告
SELECT
answer_
id
as
content_id
,
'回答'
as
type
,
user_id
,
create_time
,
content
SELECT
id
as
content_id
,
'回答'
as
type
,
user_id
,
create_time
,
content
FROM
online
.
tl_hdfs_answer_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
(
is_fake
is
NULL
or
is_fake
=
'false'
)
AND
answer_id
is
not
NULL
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
answer_id
,
user_id
,
create_time
,
content
and
is_online
=
'true'
and
is_spam
=
'false'
--排除疑似广告
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
id
,
user_id
,
create_time
,
content
UNION
ALL
--有评论过用户帖的设备
SELECT
tractate_
id
as
content_id
,
'帖子'
as
type
,
user_id
,
create_time
,
content
SELECT
id
as
content_id
,
'帖子'
as
type
,
user_id
,
create_time
,
content
FROM
online
.
tl_hdfs_api_tractate_reply_view
WHERE
partition_date
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
>=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
group
by
tractate_id
,
user_id
,
create_time
,
content
and
regexp_replace
(
substr
(
create_time
,
1
,
10
),
'-'
,
''
)
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
is_online
=
'true'
group
by
id
,
user_id
,
create_time
,
content
)
a
JOIN
--限制用户是在app进行的回复
(
SELECT
a
.
partition_date
,
user_id
FROM
(
SELECT
concat_ws
(
'-'
,
substr
(
partition_date
,
1
,
4
),
substr
(
partition_date
,
5
,
2
),
substr
(
partition_date
,
7
,
2
))
as
partition_date
,
user_id
,
device_id
,
action
FROM
online
.
bl_hdfs_operation_updates
WHERE
partition_date
>=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
AND
partition_date
<=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
)
a
JOIN
(
SELECT
code
FROM
dim
.
dim_community_action_type
WHERE
communityuserbehavior_type_name
=
'回帖'
)
type
ON
a
.
action
=
code
GROUP
BY
a
.
partition_date
,
user_id
)
b
ON
a
.
user_id
=
b
.
user_id
AND
substr
(
a
.
create_time
,
1
,
10
)
=
b
.
partition_date
--
JOIN --限制用户是在app进行的回复
--
(
--
SELECT a.partition_date,user_id
--
FROM
--
(
--
SELECT concat_ws('-',substr(partition_date,1,4),substr(partition_date,5,2),substr(partition_date,7,2)) as partition_date,user_id,device_id,action
--
FROM online.bl_hdfs_operation_updates
--
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,1) ,'-','')
--
AND partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
--
)a
--
JOIN
--
(
--
SELECT code
--
FROM dim.dim_community_action_type
--
WHERE communityuserbehavior_type_name = '回帖'
--
)type
--
ON a.action = code
--
GROUP BY a.partition_date,user_id
--
)b
--
ON a.user_id = b.user_id
--
AND substr(a.create_time,1,10)= b.partition_date
left
join
(
select
distinct
user_id
from
ml
.
ML_D_CT_UI_USERCLEAN_DIMEN_D
where
PARTITION_DAY
=
regexp_replace
(
DATE_SUB
(
current_date
,
1
)
,
'-'
,
''
)
and
is_abnormal_user
=
'true'
and
(
is_classify_user
=
'true'
or
is_puppet
=
'true'
)
)
c
on
a
.
user_id
=
c
.
user_id
where
c
.
user_id
is
null
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