Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
36216c6f
Commit
36216c6f
authored
Feb 23, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计新指标,device_clk_imp_reason
parent
8178e56b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
21 deletions
+99
-21
temp_count.scala
eda/feededa/src/main/scala/com/gmei/temp_count.scala
+99
-21
No files found.
eda/feededa/src/main/scala/com/gmei/temp_count.scala
View file @
36216c6f
...
...
@@ -717,6 +717,7 @@ object find_reason {
s
"""
|select distinct(os.device_id) as device_id
|from online.ml_device_day_active_status os left join blacklist
|on os.device_id = blacklist.device_id
|where os.active_type != '4'
|and os.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'
...
...
@@ -754,36 +755,113 @@ object find_reason {
device_id_oldUser
.
createOrReplaceTempView
(
"device_id_old"
)
//日记本转化美购
//1.日记本到美购转化数
val
diary_meigou_temp
=
sc
.
sql
(
val
all_clk
=
sc
.
sql
(
s
"""
|select
ou
.cl_id as device_id
|from online.
bl_hdfs_page_view_updates ou
left join agency_id
|on o
u
.cl_id = agency_id.device_id
|where o
u.partition_date = '${partition_date}
'
|and o
u.page_name='welfare_detail'
|and o
u.referrer='diary_detail
'
|select
'${stat_date}' as stat_date,ov
.cl_id as device_id
|from online.
tl_hdfs_maidian_view ov
left join agency_id
|on o
v
.cl_id = agency_id.device_id
|where o
v.action = 'on_click_diary_card
'
|and o
v.cl_id != "NULL"
|and o
v.partition_date='${partition_date}
'
|and agency_id.device_id is null
"""
.
stripMargin
)
diary_meigou_temp
.
createOrReplaceTempView
(
"diary_meigou_temp
"
)
all_clk
.
createOrReplaceTempView
(
"all_clk_diary_card
"
)
//1.当天老用户中的点击用户数
val
old_clk_count
=
sc
.
sql
(
s
"""
|select stat_date,count(ov.device_id) as old_clk_count
|from all_clk_diary_card oc left join device_id_old
|on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
|group by stat_date
"""
.
stripMargin
)
//1.1有点击的老用户
val
old_clk_device
=
sc
.
sql
(
s
"""
|select oc.device_id as device_id
|from all_clk_diary_card oc left join device_id_old
|on oc.device_id = device_id_old.device_id
|where device_id_old.device_id is not null
"""
.
stripMargin
)
old_clk_device
.
createOrReplaceTempView
(
"old_clk_device"
)
//2.当天新用户中的点击用户数
val
new_clk_count
=
sc
.
sql
(
s
"""
|select stat_date,count(oc.device_id) as old_clk_count
|from all_clk_diary_card oc left join device_id_new
|on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null
|group by stat_date
"""
.
stripMargin
)
//2.1 有点击的新用户
val
new_clk_device
=
sc
.
sql
(
s
"""
|select oc.device_id as device_id
|from all_clk_diary_card oc left join device_id_new
|on oc.device_id = device_id_new.device_id
|where device_id_old.device_id is not null
"""
.
stripMargin
)
new_clk_device
.
createOrReplaceTempView
(
"new_clk_device"
)
// val result = diary_meigou_newUser.join(diary_meigou_oldUser,"stat_date")
// .join(diary_clk_newUser,"stat_date")
// .join(diary_clk_oldUser,"stat_date")
// .join(diary_exp_newUser,"stat_date")
// .join(diary_exp_oldUser,"stat_date")
// .join(search_newUser,"stat_date")
// .join(search_oldUser,"stat_date")
// .join(log_newUser,"stat_date")
// .join(log_oldUser,"stat_date")
//
// GmeiConfig.writeToJDBCTable(result, "diary_meigou_crv", SaveMode.Append)
//3.当天老用户数
val
old_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(dio.device_id) as old_count
|from device_id_old dio left join agency_id
|on dio.device_id = agency_id.device_id
|where agency_id.device_id is null
"""
.
stripMargin
)
//4.当天新用户数
val
new_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(din.device_id) as new_count
|from device_id_new din left join agency_id
|on din.device_id = agency_id.device_id
|where agency_id.device_id is null
"""
.
stripMargin
)
//5.有点击老用户的曝光数
val
exp_clkold_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(din.device_id) as imp_clkold_count
|from data_feed_exposure_precise dp left join old_clk_device
|on dp.device_id = old_clk_device.device_id
|where old_clk_device.device_id is not null
"""
.
stripMargin
)
//6.有点击新用户的曝光数
val
exp_clknew_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(din.device_id) as imp_clknew_count
|from data_feed_exposure_precise dp left join new_clk_device
|on dp.device_id = new_clk_device.device_id
|where new_clk_device.device_id is not null
"""
.
stripMargin
)
val
result
=
old_clk_count
.
join
(
new_clk_count
,
"stat_date"
)
.
join
(
old_count
,
"stat_date"
)
.
join
(
new_count
,
"stat_date"
)
.
join
(
exp_clkold_count
,
"stat_date"
)
.
join
(
exp_clknew_count
,
"stat_date"
)
GmeiConfig
.
writeToJDBCTable
(
result
,
"device_clk_imp_reason"
,
SaveMode
.
Append
)
}
...
...
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