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
8ceb9182
Commit
8ceb9182
authored
Nov 21, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计参数
parent
d34f924a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
26 deletions
+52
-26
app_list.scala
eda/feededa/src/main/scala/com/gmei/app_list.scala
+52
-26
No files found.
eda/feededa/src/main/scala/com/gmei/app_list.scala
View file @
8ceb9182
...
...
@@ -100,7 +100,7 @@ object app_list {
|select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list
|from online.tl_hdfs_maidian_view ov left join agency_id
|on ov.cl_id = agency_id.device_id
|where action="user_installed_all_app_info"
|where
ov.
action="user_installed_all_app_info"
|and ov.partition_date = '${partition_date}'
|and agency_id.device_id is null
|and ov.cl_id not in (select distinct(device_id) from blacklist)
...
...
@@ -134,7 +134,7 @@ object app_list {
|from online.tl_hdfs_maidian_view ov left join agency_id
|on ov.cl_id = agency_id.device_id
|where action="user_installed_all_app_info"
|and agency_id.device_id is null
|and
ov.
agency_id.device_id is null
|and ov.partition_date = '${partition_date}'
|and ov.cl_id not in (select distinct(device_id) from blacklist)
""".stripMargin
...
...
@@ -234,20 +234,20 @@ object coincidence_xinyang {
//获取每日活跃用户中与新氧重合用户占比
//1.每日活跃中与新氧重合用户数
val
data
=
yesterday
.
replace
(
"-"
,
""
)
val
yesterday_
data
=
yesterday
.
replace
(
"-"
,
""
)
val
yesterday_coincidence
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|select '${
yesterday_
data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|from device_id_coincidence
|where stat_date = '${data}'
|where stat_date = '${
yesterday_
data}'
"""
.
stripMargin
)
//2.获得应用列表的每日活跃总用户数
val
yesterday_expoure_num
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_expoure_num
|select '${
yesterday_
data}' as stat_date,count(distinct(device_id)) as yesterday_expoure_num
|from device_id_applist
|where stat_date = '${data}'
|where stat_date = '${
yesterday_
data}'
"""
.
stripMargin
)
...
...
@@ -257,7 +257,7 @@ object coincidence_xinyang {
val
week_day
=
pre_weekday
.
replace
(
"-"
,
""
)
val
week_coincidence
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|select '${
yesterday_
data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|from device_id_coincidence
|where stat_date >= '${week_day}'
"""
.
stripMargin
...
...
@@ -265,7 +265,7 @@ object coincidence_xinyang {
//2.获得应用列表的每周活跃总用户
val
week_expoure_num
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(cl_id)) as week_expoure_num
|select '${
yesterday_
data}' as stat_date,count(distinct(cl_id)) as week_expoure_num
|from device_id_applist
|where stat_date >= '${week_day}'
"""
.
stripMargin
...
...
@@ -299,60 +299,86 @@ object coincidence_xinyang {
GmeiConfig
.
writeToJDBCTable
(
result
,
"coincidence_xinyang"
,
SaveMode
.
Append
)
/* //获取到的应用列表用户中截止目前获得的与新氧重合的用户数计算美购情况
//获取到的应用列表用户中截止目前获得的与新氧重合的用户数计算美购情况
//* 重合用户的id
val
coincidence_id
=
sc
.
sql
(
s
"""
|select distinct(device_id) as coincidence_id
|from device_id_coincidence
"""
.
stripMargin
)
coincidence_id
.
createOrReplaceTempView
(
"coincidence_id"
)
//获取应用列表的所有用户id
val
all_id
=
sc
.
sql
(
s
"""
|select distinct(device_id) as all_id
|from device_id_applist
"""
.
stripMargin
)
all_id
.
createOrReplaceTempView
(
"all_id"
)
//* 所有获得用户列表的用户id
//1.重合用户的美购数
val
meigou_coincidence_num
=
sc
.
sql
(
s
"""
|select count(service_id) as meigou_coincidence_num
|from online.ml_meigou_order_detail
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|and coincidence_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
"""
.
stripMargin
)
.repartition(100)
)
meigou_coincidence_num
.
show
()
//2.重合用户进行美购的用户数
val
meigou_pay_device
=
sc
.
sql
(
s
"""
|select count(DISTINCT(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail
|select count(distinct(service_id)) as meigou_coincidence_num
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|and coincidence_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
"""
.
stripMargin
)
.repartition(100)
)
meigou_pay_device
.
show
()
//3.获得应用列表的用户的美购数
//3.
所有
获得应用列表的用户的美购数
val
meigou_pay_all
=
sc
.
sql
(
s
"""
|select count(device_id) as meigou_pay_device
|from online.ml_meigou_order_detail od inner join all_
device_
id
|on od.device_id
=all_device
_id.device_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id
= all
_id.device_id
|where partition_date = '20181120'
|and all_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
"""
.
stripMargin
)
.repartition(100)
)
meigou_pay_all
.
show
()
//4.获得应用列表用户进行美购的用户数
//4.
所有
获得应用列表用户进行美购的用户数
val
meigou_pay_device_all
=
sc
.
sql
(
s
"""
|select count(distinct(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail od inner join all_
device_
id
|on od.device_id
=all_device
_id.device_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id
= all
_id.device_id
|where partition_date = '20181120'
|and all_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
"""
.
stripMargin
)
.repartition(100)
)
meigou_pay_device_all
.
show
()
//截止目前获得的与新氧重合的用户数咨询统计
/*
//截止目前获得的与新氧重合的用户数咨询统计
val zixun_num_all = sc.sql(
s"""
|select count(cl_id) as zixun_num_all
...
...
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