Commit 31e1f13c authored by 王志伟's avatar 王志伟

bug fix

parent 1515ac81
...@@ -41,23 +41,7 @@ object strategy_clk_imp_oldUser { ...@@ -41,23 +41,7 @@ object strategy_clk_imp_oldUser {
) )
} }
def main(args: Array[String]): Unit = {
parser.parse(args, defaultParams).map { param =>
GmeiConfig.setup(param.env)
val spark_env = GmeiConfig.getSparkSession()
val sc = spark_env._2
val ti = new TiContext(sc)
ti.tidbMapTable(dbName = "jerry_prod", tableName = "diary_video")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "data_feed_click")
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")
import sc.implicits._
// val stat_date = GmeiConfig.getMinusNDate(1)
//println(param.date)
//获得时间array //获得时间array
def get_date(): ArrayBuffer[String] ={ def get_date(): ArrayBuffer[String] ={
val startTime = "2018-10-07" val startTime = "2018-10-07"
...@@ -74,13 +58,32 @@ object strategy_clk_imp_oldUser { ...@@ -74,13 +58,32 @@ object strategy_clk_imp_oldUser {
calendar.add(dateFiled, 1) calendar.add(dateFiled, 1)
beginDate = calendar.getTime beginDate = calendar.getTime
} }
//println(dateArray) // println(dateArray)
dateArray dateArray
} }
def main(args: Array[String]): Unit = {
parser.parse(args, defaultParams).map { param =>
GmeiConfig.setup(param.env)
val spark_env = GmeiConfig.getSparkSession()
val sc = spark_env._2
val ti = new TiContext(sc)
ti.tidbMapTable(dbName = "jerry_prod", tableName = "diary_video")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "data_feed_click")
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")
import sc.implicits._
// val stat_date = GmeiConfig.getMinusNDate(1)
//println(param.date)
val date_array = get_date() val date_array = get_date()
for (elem <- date_array) { for (elem <- date_array) {
val partition_date = elem.replace("-","") val partition_date = elem.replace("-","")
println(partition_date)
val decive_id_oldUser = sc.sql( val decive_id_oldUser = sc.sql(
s""" s"""
|select distinct(device_id) as decive_id |select distinct(device_id) as decive_id
...@@ -105,6 +108,7 @@ object strategy_clk_imp_oldUser { ...@@ -105,6 +108,7 @@ object strategy_clk_imp_oldUser {
val strategies = Seq("[1|2]$","[3|4]$","[5|6]$","[7|8]$") val strategies = Seq("[1|2]$","[3|4]$","[5|6]$","[7|8]$")
for (strategy <- strategies){ for (strategy <- strategies){
println(strategy)
val clk_count_oldUser = sc.sql( val clk_count_oldUser = sc.sql(
s""" s"""
|select '${elem}' as stat_date, count(cid_id) as get_clk_count_old |select '${elem}' as stat_date, count(cid_id) as get_clk_count_old
......
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