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
c846a0a6
Commit
c846a0a6
authored
Dec 28, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smart_rank 相关的统计指标
parent
10450e7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
111 deletions
+81
-111
temp_analysis.scala
eda/feededa/src/main/scala/com/gmei/temp_analysis.scala
+81
-111
No files found.
eda/feededa/src/main/scala/com/gmei/temp_analysis.scala
View file @
c846a0a6
...
@@ -615,83 +615,83 @@ object smart_rank_count {
...
@@ -615,83 +615,83 @@ object smart_rank_count {
final_id
.
createOrReplaceTempView
(
"final_id"
)
final_id
.
createOrReplaceTempView
(
"final_id"
)
val
user_city_meigou_view
=
sc
.
sql
(
//
val user_city_meigou_view = sc.sql(
s
"""
//
s"""
|select cl_id as device_id,city_id as device_city,params['business_id'] as meigou_id
//
|select cl_id as device_id,city_id as device_city,params['business_id'] as meigou_id
|from online.tl_hdfs_maidian_view
//
|from online.tl_hdfs_maidian_view
|where action = "page_view"
//
|where action = "page_view"
|and params['page_name']="welfare_detail"
//
|and params['page_name']="welfare_detail"
|and partition_date >='20181201'
//
|and partition_date >='20181201'
|and city_id is not null
//
|and city_id is not null
"""
.
stripMargin
//
""".stripMargin
)
//
)
user_city_meigou_view
.
createOrReplaceTempView
(
"user_city_meigou_view"
)
//
user_city_meigou_view.createOrReplaceTempView("user_city_meigou_view")
//
val
meigou_city
=
sc
.
sql
(
//
val meigou_city = sc.sql(
s
"""
//
s"""
|select b.id as meigou_id,d.city_id as meigou_city
//
|select b.id as meigou_id,d.city_id as meigou_city
|from online.tl_meigou_service_view b
//
|from online.tl_meigou_service_view b
|left join online.tl_hdfs_doctor_view c on b.doctor_id=c.id
//
|left join online.tl_hdfs_doctor_view c on b.doctor_id=c.id
|left join online.tl_hdfs_hospital_view d on c.hospital_id=d.id
//
|left join online.tl_hdfs_hospital_view d on c.hospital_id=d.id
|where b.partition_date='20181227'
//
|where b.partition_date='20181227'
|and c.partition_date='20181227'
//
|and c.partition_date='20181227'
|and d.partition_date='20181227'
//
|and d.partition_date='20181227'
"""
.
stripMargin
//
""".stripMargin
)
//
)
meigou_city
.
createOrReplaceTempView
(
"meigou_city"
)
//
meigou_city.createOrReplaceTempView("meigou_city")
//
//
val
meigou_pv_tongcheng
=
sc
.
sql
(
//
val meigou_pv_tongcheng = sc.sql(
s
"""
//
s"""
|select a.device_id,a.device_city,a.meigou_id,b.meigou_city
//
|select a.device_id,a.device_city,a.meigou_id,b.meigou_city
|from user_city_meigou_view a
//
|from user_city_meigou_view a
|left join meigou_city b
//
|left join meigou_city b
|on a.meigou_id=b.meigou_id
//
|on a.meigou_id=b.meigou_id
"""
.
stripMargin
//
""".stripMargin
)
//
)
meigou_pv_tongcheng
.
createOrReplaceTempView
(
"meigou_pv_tongcheng"
)
//
meigou_pv_tongcheng.createOrReplaceTempView("meigou_pv_tongcheng")
//
val
meigou_pv_count
=
sc
.
sql
(
//
val meigou_pv_count = sc.sql(
s
"""
//
s"""
|select meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num
//
|select meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num
|from meigou_pv_tongcheng
//
|from meigou_pv_tongcheng
|where device_city=meigou_city
//
|where device_city=meigou_city
|group by meigou_city
//
|group by meigou_city
"""
.
stripMargin
//
""".stripMargin
)
//
)
meigou_pv_count
.
show
()
//
meigou_pv_count.show()
//
//
//开始计算咨询
//
//
开始计算咨询
val
zixun_meigou_view
=
sc
.
sql
(
//
val zixun_meigou_view = sc.sql(
s
"""
//
s"""
|select cl_id as device_id,city_id as device_city,params['service_id'] as meigou_id
//
|select cl_id as device_id,city_id as device_city,params['service_id'] as meigou_id
|from online.tl_hdfs_maidian_view
//
|from online.tl_hdfs_maidian_view
|where partition_date >= '20181201'
//
|where partition_date >= '20181201'
|and action = 'welfare_detail_click_message'
//
|and action = 'welfare_detail_click_message'
"""
.
stripMargin
//
""".stripMargin
)
//
)
zixun_meigou_view
.
createOrReplaceTempView
(
"zixun_meigou_view"
)
//
zixun_meigou_view.createOrReplaceTempView("zixun_meigou_view")
//
val
zixun_meigou_tongcheng
=
sc
.
sql
(
//
val zixun_meigou_tongcheng = sc.sql(
s
"""
//
s"""
|select a.device_id,a.device_city,a.meigou_id,b.meigou_city
//
|select a.device_id,a.device_city,a.meigou_id,b.meigou_city
|from zixun_meigou_view a
//
|from zixun_meigou_view a
|left join meigou_city b
//
|left join meigou_city b
|on a.meigou_id=b.meigou_id
//
|on a.meigou_id=b.meigou_id
"""
.
stripMargin
//
""".stripMargin
)
//
)
zixun_meigou_tongcheng
.
createOrReplaceTempView
(
"zixun_meigou_tongcheng"
)
//
zixun_meigou_tongcheng.createOrReplaceTempView("zixun_meigou_tongcheng")
//
val
zixun_pv_count
=
sc
.
sql
(
//
val zixun_pv_count = sc.sql(
s
"""
//
s"""
|select meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num
//
|select meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num
|from zixun_meigou_tongcheng
//
|from zixun_meigou_tongcheng
|where device_city=meigou_city
//
|where device_city=meigou_city
|group by meigou_city
//
|group by meigou_city
"""
.
stripMargin
//
""".stripMargin
)
//
)
zixun_pv_count
.
show
()
//
zixun_pv_count.show()
...
@@ -699,47 +699,17 @@ object smart_rank_count {
...
@@ -699,47 +699,17 @@ object smart_rank_count {
val
device_new_count
=
sc
.
sql
(
val
device_new_count
=
sc
.
sql
(
s
"""
s
"""
|select
partition_date
,count(distinct(device_id))
|select
fisrt_city
,count(distinct(device_id))
|from online.ml_device_day_active_status
|from online.ml_device_day_active_status
|where active_type != '4'
|where active_type != '4'
|and partition_date
='20181212
'
|and partition_date
>='20181201
'
|
and first_city !='worldwide'
|
group by fisrt_city
"""
.
stripMargin
"""
.
stripMargin
)
)
device_new_count
.
show
()
// val meigou_price = sc.sql(
// s"""
// |select md.user_id,sum(md.gengmei_price) as pay_all
// |from online.ml_meigou_order_detail md
// |left join
// |(
// | SELECT
// | order_id
// | FROM mining.ml_order_spam_recognize
// | WHERE partition_date='20181223' AND
// | self_support=0 AND dayBitsGetW1(predict_result,'20181223')=0
// |)spam
// |on md.order_id = spam.order_id
// |where md.status= 2
// |and spam.order_id is null
// |and md.partition_date = '20181223'
// |and md.pay_time is not null
// |and md.validate_time>'2017-01-01 00:00:00.0'
// |group by md.user_id
// |order by sum(md.gengmei_price)
// """.stripMargin
// )
// GmeiConfig.writeToJDBCTable(meigou_price, "meigou_price", SaveMode.Overwrite)
}
}
...
...
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