Commit 7bb537bf authored by 魏艺敏's avatar 魏艺敏

Merge branch 'weiyimin' into 'master'

push codes

See merge request !87
parents 44141d2e 464822c3
...@@ -4,14 +4,15 @@ select a.* ...@@ -4,14 +4,15 @@ select a.*
FROM 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 FROM
( (
SELECT id,problem_id,user_id,reply_date as create_time,content SELECT id,problem_id,user_id,reply_date as create_time,content
FROM online.tl_hdfs_topicreply_view FROM online.tl_hdfs_topicreply_view
WHERE partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','') WHERE partition_date = regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND is_spam = 'false' --排除疑似广告 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 group by id,problem_id,user_id,reply_date,content
)t1 )t1
JOIN JOIN
...@@ -22,57 +23,60 @@ FROM ...@@ -22,57 +23,60 @@ FROM
group by id,diary_id group by id,diary_id
)t2 )t2
on t2.id=t1.problem_id 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 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 FROM online.tl_hdfs_answer_reply_view
WHERE partition_date =regexp_replace(DATE_SUB(current_date,1) ,'-','') WHERE partition_date =regexp_replace(DATE_SUB(current_date,1) ,'-','')
and (is_fake is NULL or is_fake = 'false') and (is_fake is NULL or is_fake = 'false')
AND answer_id is not NULL AND answer_id is not NULL
and regexp_replace(substr(create_time,1,10),'-','') >= regexp_replace(DATE_SUB(current_date,1) ,'-','') and is_online='true'
group by answer_id,user_id,create_time,content 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 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 FROM online.tl_hdfs_api_tractate_reply_view
WHERE partition_date =regexp_replace(DATE_SUB(current_date,1) ,'-','') 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) ,'-','') 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 is_online='true'
group by id,user_id,create_time,content
)a )a
JOIN --限制用户是在app进行的回复 --JOIN --限制用户是在app进行的回复
( --(
SELECT a.partition_date,user_id -- SELECT a.partition_date,user_id
FROM -- 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 -- 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 -- FROM online.bl_hdfs_operation_updates
WHERE partition_date>=regexp_replace(DATE_SUB(current_date,1) ,'-','') -- WHERE partition_date>=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','') -- AND partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
)a -- )a
JOIN -- JOIN
( -- (
SELECT code -- SELECT code
FROM dim.dim_community_action_type -- FROM dim.dim_community_action_type
WHERE communityuserbehavior_type_name = '回帖' -- WHERE communityuserbehavior_type_name = '回帖'
)type -- )type
ON a.action = code -- ON a.action = code
GROUP BY a.partition_date,user_id -- GROUP BY a.partition_date,user_id
)b --)b
ON a.user_id = b.user_id -- ON a.user_id = b.user_id
AND substr(a.create_time,1,10)= b.partition_date -- AND substr(a.create_time,1,10)= b.partition_date
left join left join
( (
select distinct user_id select distinct user_id
from ml.ML_D_CT_UI_USERCLEAN_DIMEN_D from ml.ML_D_CT_UI_USERCLEAN_DIMEN_D
where PARTITION_DAY =regexp_replace(DATE_SUB(current_date,1) ,'-','') 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 )c
on a.user_id=c.user_id on a.user_id=c.user_id
where c.user_id is null where c.user_id is null
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment