Commit bea08534 authored by 王志伟's avatar 王志伟

smart_rank 相关的统计指标

parent 6e3e5b99
......@@ -602,7 +602,6 @@ object smart_rank_count {
""".stripMargin
)
blacklist_id.createOrReplaceTempView("blacklist_id")
blacklist_id.show()
val final_id = sc.sql(
s"""
......@@ -614,20 +613,20 @@ object smart_rank_count {
""".stripMargin
)
final_id.createOrReplaceTempView("final_id")
final_id.show()
val user_city_meigou_view = sc.sql(
s"""
|select cl_id as device_id,city_id as device_city,params['business_id'] as meigou_id
|from online.tl_hdfs_maidian_view
|where action = "page_view"
|and params['page_name']="welfare_detail"
|and partition_date >='20181201'
|and city_id is not null
|select ov.cl_id as device_id,ov.city_id as device_city,ov.params['business_id'] as meigou_id
|from online.tl_hdfs_maidian_view ov left join final_id
|on ov.cl_id = final_id.device_id
|where ov.action = "page_view"
|and ov.params['page_name']="welfare_detail"
|and ov.partition_date >='20181201'
|and ov.city_id is not null
|and final_id.device_id is null
""".stripMargin
)
user_city_meigou_view.show()
user_city_meigou_view.createOrReplaceTempView("user_city_meigou_view")
val meigou_city = sc.sql(
......@@ -702,17 +701,17 @@ object smart_rank_count {
//开始计算每个地区每月新增设备
// val device_new_count = sc.sql(
// s"""
// |select first_city,count(distinct(device_id))
// |from online.ml_device_day_active_status
// |where active_type != '4'
// |and partition_date >='20181201'
// |group by first_city
// |order by first_city
// """.stripMargin
// )
// device_new_count.show()
val device_new_count = sc.sql(
s"""
|select first_city,count(distinct(device_id))
|from online.ml_device_day_active_status
|where active_type != '4'
|and partition_date >='20181201'
|group by first_city
|order by first_city
""".stripMargin
)
device_new_count.show()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment