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
596782ff
Commit
596782ff
authored
Nov 23, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新需求
parent
3a2ce602
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
34 deletions
+79
-34
app_list.scala
eda/feededa/src/main/scala/com/gmei/app_list.scala
+79
-34
No files found.
eda/feededa/src/main/scala/com/gmei/app_list.scala
View file @
596782ff
...
@@ -92,9 +92,8 @@ object app_list {
...
@@ -92,9 +92,8 @@ object app_list {
agency_id
.
show
()
agency_id
.
show
()
agency_id
.
createOrReplaceTempView
(
"agency_id"
)
agency_id
.
createOrReplaceTempView
(
"agency_id"
)
//获取与新氧用户重合的用户device_id
//获取与新氧用户重合的用户device_id
/*
val app_list = sc.sql(
val
app_list
=
sc
.
sql
(
s
"""
s
"""
|select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list,channel
|select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list,channel
|from online.tl_hdfs_maidian_view ov left join agency_id
|from online.tl_hdfs_maidian_view ov left join agency_id
...
@@ -140,7 +139,7 @@ object app_list {
...
@@ -140,7 +139,7 @@ object app_list {
)
)
val
tempp_list
=
app_list_all
.
withColumn
(
"stat_date"
,
addCol
(
app_list_all
(
"device_id"
)))
val
tempp_list
=
app_list_all
.
withColumn
(
"stat_date"
,
addCol
(
app_list_all
(
"device_id"
)))
GmeiConfig.writeToJDBCTable(tempp_list, "device_id_applist", SaveMode.Append)
*/
GmeiConfig
.
writeToJDBCTable
(
tempp_list
,
"device_id_applist"
,
SaveMode
.
Append
)
//在更美有消费的用户列表
//在更美有消费的用户列表
...
@@ -350,51 +349,51 @@ object coincidence_xinyang {
...
@@ -350,51 +349,51 @@ object coincidence_xinyang {
//* 所有获得用户列表的用户id
//* 所有获得用户列表的用户id
//1.重合用户的美购数
//1.重合用户的美购数
val
meigou_
coincidence_num
=
sc
.
sql
(
val
meigou_
1
=
sc
.
sql
(
s
"""
s
"""
|select count(ov.device_id) as meigou_
coincidence_num
|select count(ov.device_id) as meigou_
1
|from online.ml_meigou_order_detail ov left join coincidence_id
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|where
ov.
partition_date = '20181120'
|and coincidence_id.device_id is not null
|and coincidence_id.device_id is not null
|and ov.pay_time is not null
|and ov.pay_time is not null
|and ov.pay_time >= '2017-11-18'
|and ov.pay_time >= '2017-11-18'
"""
.
stripMargin
"""
.
stripMargin
)
)
meigou_
coincidence_num
.
show
()
meigou_
1
.
show
()
//2.重合用户进行美购的用户数
//2.重合用户进行美购的用户数
val
meigou_
pay_device
=
sc
.
sql
(
val
meigou_
2
=
sc
.
sql
(
s
"""
s
"""
|select count(distinct(ov.device_id)) as meigou_
coincidence_num
|select count(distinct(ov.device_id)) as meigou_
2
|from online.ml_meigou_order_detail ov left join coincidence_id
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|where
ov.
partition_date = '20181120'
|and coincidence_id.device_id is not null
|and coincidence_id.device_id is not null
|and ov.pay_time is not null
|and ov.pay_time is not null
|and ov.pay_time >= '2017-11-18'
|and ov.pay_time >= '2017-11-18'
"""
.
stripMargin
"""
.
stripMargin
)
)
meigou_
pay_device
.
show
()
meigou_
2
.
show
()
//3.所有获得应用列表的用户的美购数
//3.所有获得应用列表的用户的美购数
val
meigou_
pay_all
=
sc
.
sql
(
val
meigou_
3
=
sc
.
sql
(
s
"""
s
"""
|select count(od.device_id) as meigou_
pay_device
|select count(od.device_id) as meigou_
3
|from online.ml_meigou_order_detail od inner join all_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id
|on od.device_id = all_id.device_id
|where partition_date = '20181120'
|where
od.
partition_date = '20181120'
|and all_id.device_id is not null
|and all_id.device_id is not null
|and od.pay_time is not null
|and od.pay_time is not null
|and od.pay_time >= '2017-11-18'
|and od.pay_time >= '2017-11-18'
"""
.
stripMargin
"""
.
stripMargin
)
)
meigou_
pay_all
.
show
()
meigou_
3
.
show
()
//4.所有获得应用列表用户进行美购的用户数
//4.所有获得应用列表用户进行美购的用户数
val
meigou_
pay_device_all
=
sc
.
sql
(
val
meigou_
4
=
sc
.
sql
(
s
"""
s
"""
|select count(distinct(od.device_id)) as meigou_
pay_device
|select count(distinct(od.device_id)) as meigou_
4
|from online.ml_meigou_order_detail od inner join all_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id
|on od.device_id = all_id.device_id
|where partition_date = '20181120'
|where partition_date = '20181120'
...
@@ -403,12 +402,37 @@ object coincidence_xinyang {
...
@@ -403,12 +402,37 @@ object coincidence_xinyang {
|and od.pay_time >= '2017-11-18'
|and od.pay_time >= '2017-11-18'
"""
.
stripMargin
"""
.
stripMargin
)
)
meigou_pay_device_all
.
show
()
meigou_4
.
show
()
// 5.所有用户过去一年的美购数
val
meigou_5
=
sc
.
sql
(
s
"""
|select count(device_id) as meigou_5
|from online.ml_meigou_order_detail
|where partition_date = '20181120'
|and pay_time is not null
|and pay_time >= '2017-11-18'
"""
.
stripMargin
)
meigou_5
.
show
()
// 56.所有用户过去一年的美购用户数
val
meigou_6
=
sc
.
sql
(
s
"""
|select count(distinct(device_id)) as meigou_6
|from online.ml_meigou_order_detail
|where partition_date = '20181120'
|and pay_time is not null
|and pay_time >= '2017-11-18'
"""
.
stripMargin
)
meigou_6
.
show
()
//截止目前获得的与新氧重合的用户数咨询统计
//截止目前获得的与新氧重合的用户数咨询统计
/* val zixun_num_all = sc.sql(
//1.与新氧重合用户的美购咨询数
val
zixun_1
=
sc
.
sql
(
s
"""
s
"""
|select count(ov.cl_id) as zixun_
num_all
|select count(ov.cl_id) as zixun_
1
|from online.tl_hdfs_maidian_view ov left join coincidence_id
|from online.tl_hdfs_maidian_view ov left join coincidence_id
|on ov.cl_id = coincidence_id.device_id
|on ov.cl_id = coincidence_id.device_id
|where partition_date >= '20180501'
|where partition_date >= '20180501'
...
@@ -416,11 +440,11 @@ object coincidence_xinyang {
...
@@ -416,11 +440,11 @@ object coincidence_xinyang {
|and action = 'welfare_detail_click_message'
|and action = 'welfare_detail_click_message'
"""
.
stripMargin
"""
.
stripMargin
)
)
zixun_
num_all
.show()
zixun_
1
.
show
()
//2.与新氧重合用户的美购咨询用户数
val zixun_
device_all
= sc.sql(
val
zixun_
2
=
sc
.
sql
(
s
"""
s
"""
|select count(distinct(ov.cl_id)) as zixun_
num_all
|select count(distinct(ov.cl_id)) as zixun_
2
|from online.tl_hdfs_maidian_view ov left join coincidence_id
|from online.tl_hdfs_maidian_view ov left join coincidence_id
|on ov.cl_id = coincidence_id.device_id
|on ov.cl_id = coincidence_id.device_id
|where partition_date >= '20180501'
|where partition_date >= '20180501'
...
@@ -428,31 +452,52 @@ object coincidence_xinyang {
...
@@ -428,31 +452,52 @@ object coincidence_xinyang {
|and action = 'welfare_detail_click_message'
|and action = 'welfare_detail_click_message'
"""
.
stripMargin
"""
.
stripMargin
)
)
zixun_
device_all
.show()
zixun_
2
.
show
()
*/
//3.已经获得应用列表用户的美购咨询次数
val
zixun_
num_co
=
sc
.
sql
(
val
zixun_
3
=
sc
.
sql
(
s
"""
s
"""
|select count(ov.cl_id) as zixun_
num_all
|select count(ov.cl_id) as zixun_
3
|from online.tl_hdfs_maidian_view ov left join all_id
|from online.tl_hdfs_maidian_view ov left join all_id
|on ov.cl_id = all_id.device_id
|on ov.cl_id = all_id.device_id
|where partition_date >= '20180501'
|where partition_date >= '20180501'
|and all_id.device_id is not null
|and all_id.device_id is not null
|and action = 'welfare_detail_click_message'
|and
ov.
action = 'welfare_detail_click_message'
"""
.
stripMargin
"""
.
stripMargin
)
)
zixun_
num_co
.
show
()
zixun_
3
.
show
()
//4.已经获得应用列表用户的美购咨询用户数
val
zixun_
num_co_dis
=
sc
.
sql
(
val
zixun_
4
=
sc
.
sql
(
s
"""
s
"""
|select count(distinct(ov.cl_id)) as zixun_
num_all
|select count(distinct(ov.cl_id)) as zixun_
4
|from online.tl_hdfs_maidian_view ov left join all_id
|from online.tl_hdfs_maidian_view ov left join all_id
|on ov.cl_id = all_id.device_id
|on ov.cl_id = all_id.device_id
|where partition_date >= '20180501'
|where partition_date >= '20180501'
|and all_id.device_id is not null
|and all_id.device_id is not null
|and ov.action = 'welfare_detail_click_message'
"""
.
stripMargin
)
zixun_4
.
show
()
//5.所有用户的美购咨询数
val
zixun_5
=
sc
.
sql
(
s
"""
|select count(cl_id) as zixun_5
|from online.tl_hdfs_maidian_view
|where partition_date >= '20180501'
|and action = 'welfare_detail_click_message'
"""
.
stripMargin
)
zixun_5
.
show
()
//6.所有用户的美购咨询用户数
val
zixun_6
=
sc
.
sql
(
s
"""
|select count(distinct(cl_id)) as zixun_6
|from online.tl_hdfs_maidian_view
|where partition_date >= '20180501'
|and action = 'welfare_detail_click_message'
|and action = 'welfare_detail_click_message'
"""
.
stripMargin
"""
.
stripMargin
)
)
zixun_
num_co_dis
.
show
()
zixun_
6
.
show
()
...
...
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