Commit 11d8023e authored by 王志伟's avatar 王志伟

新统计需求

parent f0834019
......@@ -154,7 +154,7 @@ object coincidence_xinyang {
ti.tidbMapTable(dbName = "jerry_prod", tableName = "blacklist")
ti.tidbMapTable(dbName = "jerry_test", tableName = "bl_device_list")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "data_feed_exposure")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "device_id_contain")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "device_id_coincidence")
//println(param.date)
......@@ -200,7 +200,7 @@ object coincidence_xinyang {
val yesterday_coincidence = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|from device_id_contain
|from device_id_coincidence
|where stat_date = '${data}'
""".stripMargin
)
......@@ -220,7 +220,7 @@ object coincidence_xinyang {
val week_coincidence = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|from device_id_contain
|from device_id_coincidence
|where stat_date > '${week_day}'
""".stripMargin
)
......@@ -240,7 +240,7 @@ object coincidence_xinyang {
val month_coincidence = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as month_coincidence_num
|from device_id_contain
|from device_id_coincidence
|where stat_date > '${month_day}'
""".stripMargin
)
......@@ -260,7 +260,32 @@ object coincidence_xinyang {
.join(month_coincidence,"stat_date")
.join(month_expoure_num,"stat_date")
GmeiConfig.writeToJDBCTable(result, "coincidence_xinyang", SaveMode.Append)
//GmeiConfig.writeToJDBCTable(result, "coincidence_xinyang", SaveMode.Append)
//截止目前获得的与新氧重合的用户数计算美购情况
val meigou_coincidence_num = sc.sql(
s"""
|select count(service_id) as meigou_coincidence_num
|from online.ml_meigou_order_detail
|where partition_date = '20181118'
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
""".stripMargin
)
meigou_coincidence_num.show()
val meigou_pay_device = sc.sql(
s"""
|select count(DISTINCT(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail
|where partition_date = '20181118'
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
""".stripMargin
)
meigou_pay_device.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