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
afcefb4a
Commit
afcefb4a
authored
Nov 21, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计参数
parent
fa7425c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
31 deletions
+13
-31
app_list.scala
eda/feededa/src/main/scala/com/gmei/app_list.scala
+13
-31
No files found.
eda/feededa/src/main/scala/com/gmei/app_list.scala
View file @
afcefb4a
...
...
@@ -94,13 +94,15 @@ object app_list {
/*
//获取策略命中用户device_id
//获取策略命中用户device_id
val
app_list
=
sc
.
sql
(
s
"""
|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
|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 partition_date = '${partition_date}'
|and agency_id.device_id is null
"""
.
stripMargin
)
//app_list.show()
...
...
@@ -115,7 +117,6 @@ object app_list {
s
"""
|select *
|from device_id
|where device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
"""
.
stripMargin
)
...
...
@@ -124,10 +125,10 @@ object app_list {
temp
.
show
()
GmeiConfig
.
writeToJDBCTable
(
tempp
,
"device_id_coincidence"
,
SaveMode
.
Append
)
*/
//所有获得应用列表的用户device_id
val
app_list_all
=
sc
.
sql
(
/*
val app_list_all = sc.sql(
s"""
|select distinct(cl_id) as device_id, user_id as user_id
|from online.tl_hdfs_maidian_view ov left join agency_id
...
...
@@ -141,7 +142,7 @@ object app_list {
val tempp_list=app_list_all.withColumn("stat_date",addCol(app_list_all("device_id")))
GmeiConfig.writeToJDBCTable(tempp_list, "device_id_applist", SaveMode.Append)
*/
}
...
...
@@ -191,7 +192,7 @@ object coincidence_xinyang {
val
ti
=
new
TiContext
(
sc
)
ti
.
tidbMapTable
(
dbName
=
"jerry_prod"
,
tableName
=
"blacklist"
)
ti
.
tidbMapTable
(
dbName
=
"jerry_test"
,
tableName
=
"
bl_device_
list"
)
ti
.
tidbMapTable
(
dbName
=
"jerry_test"
,
tableName
=
"
device_id_app
list"
)
ti
.
tidbMapTable
(
dbName
=
"jerry_prod"
,
tableName
=
"device_id_coincidence"
)
...
...
@@ -230,20 +231,7 @@ object coincidence_xinyang {
val
pre_monthday
=
getMonthDay
()
println
(
pre_monthday
)
//获取截止目前获得应用列表的用户的device_id
/* val all_device_id = sc.sql(
s"""
|select distinct(cl_id) as device_id
|from online.tl_hdfs_maidian_view
|where action="user_installed_all_app_info"
|and partition_date >= '20181114'
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
""".stripMargin
)
all_device_id.createOrReplaceTempView("all_device_id")
*/
//获取每日活跃用户中与新氧重合用户占比
//1.每日活跃中与新氧重合用户数
val
data
=
yesterday
.
replace
(
"-"
,
""
)
...
...
@@ -257,12 +245,9 @@ object coincidence_xinyang {
//2.获得应用列表的每日活跃总用户数
val
yesterday_expoure_num
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(cl_id)) as yesterday_expoure_num
|from online.tl_hdfs_maidian_view
|where partition_date = '${data}'
|and action="user_installed_all_app_info"
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_expoure_num
|from device_id_applist
|where stat_date = '${data}'
"""
.
stripMargin
)
...
...
@@ -281,11 +266,8 @@ object coincidence_xinyang {
val
week_expoure_num
=
sc
.
sql
(
s
"""
|select '${data}' as stat_date,count(distinct(cl_id)) as week_expoure_num
|from online.tl_hdfs_maidian_view
|where partition_date >= '${week_day}'
|and action="user_installed_all_app_info"
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
|from device_id_applist
|where stat_date >= '${week_day}'
"""
.
stripMargin
)
...
...
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