Commit 65e952af authored by 王志伟's avatar 王志伟

smart_rank 相关的统计指标

parent f21dd1fa
...@@ -615,83 +615,87 @@ object smart_rank_count { ...@@ -615,83 +615,87 @@ 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 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 |from online.tl_hdfs_maidian_view ov left join final_id
// |where action = "page_view" |on ov.cl_id = final_id.device_id
// |and params['page_name']="welfare_detail" |where ov.action = "page_view"
// |and partition_date >='20181201' |and ov.params['page_name']="welfare_detail"
// |and city_id is not null |and ov.partition_date >='20181201'
// """.stripMargin |and ov.city_id is not null
// ) |and final_id.device_id is null
// user_city_meigou_view.createOrReplaceTempView("user_city_meigou_view") """.stripMargin
// )
// val meigou_city = sc.sql( user_city_meigou_view.createOrReplaceTempView("user_city_meigou_view")
// s"""
// |select b.id as meigou_id,d.city_id as meigou_city val meigou_city = sc.sql(
// |from online.tl_meigou_service_view b s"""
// |left join online.tl_hdfs_doctor_view c on b.doctor_id=c.id |select b.id as meigou_id,d.city_id as meigou_city
// |left join online.tl_hdfs_hospital_view d on c.hospital_id=d.id |from online.tl_meigou_service_view b
// |where b.partition_date='20181227' |left join online.tl_hdfs_doctor_view c on b.doctor_id=c.id
// |and c.partition_date='20181227' |left join online.tl_hdfs_hospital_view d on c.hospital_id=d.id
// |and d.partition_date='20181227' |where b.partition_date='20181227'
// """.stripMargin |and c.partition_date='20181227'
// ) |and d.partition_date='20181227'
// meigou_city.createOrReplaceTempView("meigou_city") """.stripMargin
// )
// meigou_city.createOrReplaceTempView("meigou_city")
// val meigou_pv_tongcheng = sc.sql(
// s"""
// |select a.device_id,a.device_city,a.meigou_id,b.meigou_city val meigou_pv_tongcheng = sc.sql(
// |from user_city_meigou_view a s"""
// |left join meigou_city b |select a.device_id,a.device_city,a.meigou_id,b.meigou_city
// |on a.meigou_id=b.meigou_id |from user_city_meigou_view a
// """.stripMargin |left join meigou_city b
// ) |on a.meigou_id=b.meigou_id
// meigou_pv_tongcheng.createOrReplaceTempView("meigou_pv_tongcheng") """.stripMargin
// )
// val meigou_pv_count = sc.sql( meigou_pv_tongcheng.createOrReplaceTempView("meigou_pv_tongcheng")
// s"""
// |select meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num val meigou_pv_count = sc.sql(
// |from meigou_pv_tongcheng s"""
// |where device_city=meigou_city |select meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num
// |group by meigou_city |from meigou_pv_tongcheng
// """.stripMargin |where device_city=meigou_city
// ) |group by meigou_city
// meigou_pv_count.show() """.stripMargin
// )
// meigou_pv_count.show()
////开始计算咨询
// val zixun_meigou_view = sc.sql(
// s""" //开始计算咨询
// |select cl_id as device_id,city_id as device_city,params['service_id'] as meigou_id val zixun_meigou_view = sc.sql(
// |from online.tl_hdfs_maidian_view s"""
// |where partition_date >= '20181201' |select ov.cl_id as device_id,ov.city_id as device_city,ov.params['service_id'] as meigou_id
// |and action = 'welfare_detail_click_message' |from online.tl_hdfs_maidian_view ov left join final_id
// """.stripMargin |on ov.cl_id = final_id.device_id
// ) |where ov.partition_date >= '20181201'
// zixun_meigou_view.createOrReplaceTempView("zixun_meigou_view") |and ov.action = 'welfare_detail_click_message'
// |and final_id.device_id is null
// val zixun_meigou_tongcheng = sc.sql( """.stripMargin
// s""" )
// |select a.device_id,a.device_city,a.meigou_id,b.meigou_city zixun_meigou_view.createOrReplaceTempView("zixun_meigou_view")
// |from zixun_meigou_view a
// |left join meigou_city b val zixun_meigou_tongcheng = sc.sql(
// |on a.meigou_id=b.meigou_id s"""
// """.stripMargin |select a.device_id,a.device_city,a.meigou_id,b.meigou_city
// ) |from zixun_meigou_view a
// zixun_meigou_tongcheng.createOrReplaceTempView("zixun_meigou_tongcheng") |left join meigou_city b
// |on a.meigou_id=b.meigou_id
// val zixun_pv_count = sc.sql( """.stripMargin
// s""" )
// |select meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num zixun_meigou_tongcheng.createOrReplaceTempView("zixun_meigou_tongcheng")
// |from zixun_meigou_tongcheng
// |where device_city=meigou_city val zixun_pv_count = sc.sql(
// |group by meigou_city s"""
// """.stripMargin |select meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num
// ) |from zixun_meigou_tongcheng
// zixun_pv_count.show() |where device_city=meigou_city
|group by meigou_city
""".stripMargin
)
zixun_pv_count.show()
...@@ -704,6 +708,7 @@ object smart_rank_count { ...@@ -704,6 +708,7 @@ object smart_rank_count {
|where active_type != '4' |where active_type != '4'
|and partition_date >='20181201' |and partition_date >='20181201'
|group by first_city |group by first_city
|order by first_city
""".stripMargin """.stripMargin
) )
device_new_count.show() 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