Commit 2bf4c078 authored by 王志伟's avatar 王志伟

统计运维想要数据

parent 719cd0c6
...@@ -804,19 +804,18 @@ object tag_value { ...@@ -804,19 +804,18 @@ object tag_value {
level_index_temp.createOrReplaceTempView("level_index_temp") level_index_temp.createOrReplaceTempView("level_index_temp")
// temp1.createOrReplaceTempView("temp1")
// import implicit_
val result = level_index_temp.select("tag_id").distinct().rdd.map{x => x.toString().substring(1,x.toString().length - 1)}.zipWithIndex().toDF("level_id","index_id")
val test=result.select(result.col("level_id").cast(DoubleType).as("level_id"),result.col("index_id").cast(DoubleType).as("index_id"))
test.createOrReplaceTempView("tag_level_index")
// val resDf = spark.createDataFrame(rowRdd)
// val result = level_index_temp.select("tag_id").distinct().rdd.map{x => x.toString().substring(1,x.toString().length - 1)}.zipWithIndex().toDF("level_id","index_id")
println("开始写入") // val test=result.select(result.col("level_id").cast(DoubleType).as("level_id"),result.col("index_id").cast(DoubleType).as("index_id"))
GmeiConfig.writeToJDBCTable("jdbc:mysql://172.16.40.158:4000/jerry_prod?user=root&password=3SYz54LS9#^9sBvC&rewriteBatchedStatements=true",test, table="tag_level_index",SaveMode.Overwrite) // test.createOrReplaceTempView("tag_level_index")
//// val resDf = spark.createDataFrame(rowRdd)
println("写入完成") //
//
// println("开始写入")
// GmeiConfig.writeToJDBCTable("jdbc:mysql://172.16.40.158:4000/jerry_prod?user=root&password=3SYz54LS9#^9sBvC&rewriteBatchedStatements=true",test, table="tag_level_index",SaveMode.Overwrite)
//
// println("写入完成")
// zhengxing库里面的数据同步到jerry_prod // zhengxing库里面的数据同步到jerry_prod
...@@ -825,7 +824,7 @@ object tag_value { ...@@ -825,7 +824,7 @@ object tag_value {
s""" s"""
|select a.device_id,c.index_id as action,b.value from jerry_prod.icon_train_data a |select a.device_id,c.index_id as action,b.value from jerry_prod.icon_train_data a
|left join tagId_value b on a.tag_id=b.level_id |left join tagId_value b on a.tag_id=b.level_id
|left join tag_level_index c on a.tag_id=c.level_id |left join jerry_prod.tag_level_index c on a.tag_id=c.level_id
|where c.index_id is not null and b.value is not null |where c.index_id is not null and b.value is not null
|and a.stat_date='${stat_date}' |and a.stat_date='${stat_date}'
""".stripMargin """.stripMargin
......
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