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

smart_rank 相关的统计指标

parent bea08534
......@@ -655,13 +655,13 @@ object smart_rank_count {
val meigou_pv_count = sc.sql(
s"""
|select meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num
|select '2018-12' as stat_date,meigou_city,count(device_id) as meigou_pv,count(distinct(device_id)) as meigou_device_num
|from meigou_pv_tongcheng
|where device_city = meigou_city
|group by meigou_city
""".stripMargin
)
meigou_pv_count.show()
meigou_pv_count.createOrReplaceTempView("meigou_pv_count")
//开始计算咨询
......@@ -689,13 +689,24 @@ object smart_rank_count {
val zixun_pv_count = sc.sql(
s"""
|select meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num
|select '2018-12' as stat_date,meigou_city,count(device_id) as meigou_zixun,count(distinct(device_id)) as meigou_zixun_device_num
|from zixun_meigou_tongcheng
|where device_city=meigou_city
|group by meigou_city
""".stripMargin
)
zixun_pv_count.show()
zixun_pv_count.createOrReplaceTempView("zixun_pv_count")
val all_count = sc.sql(
s"""
|select mc.stat_date,mc.meigou_city,mc.meigou_pv,mc.meigou_device_num,zc.meigou_zixun,zc.meigou_zixun_device_num
|from meigou_pv_count mc left join zixun_pv_count zc
|on mc.meigou_city = zc.meigou_city
""".stripMargin
)
all_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