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

测试埋点数据

parent d7c3ca12
......@@ -622,20 +622,7 @@ object icon_train_data {
temp_meigou.createOrReplaceTempView("temp_meigou")
val final_train = sc.sql(
s"""
|select *
|from temp_diary
|union all
|select *
|from temp_meigou
""".stripMargin
)
final_train.show()
// 百科点击数据
val wiki_click=sc.sql(
s"""
|SELECT cl_id as device_id,params['business_id'] as wiki_id
......@@ -644,12 +631,46 @@ object icon_train_data {
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')
""".stripMargin
)
wiki_click.createOrReplaceTempView("wiki_click")
val wiki_tag=sc.sql(
s"""
|SELECT item_id,tag_id
|from online.tl_hdfs_wiki_item_tag_view
|where partition_date='${partition_date}'
""".stripMargin
)
wiki_tag.createOrReplaceTempView("wiki_tag")
val wiki_device_tag=sc.sql(
s"""
|SELECT a.device_id,b.tag_id
|from wiki_click a
|left join wiki_tag b
|on a.wiki_id=b.item_id
|where b.tag_id is not null
""".stripMargin
)
wiki_device_tag.createOrReplaceTempView("wiki_device_tag")
val final_train = sc.sql(
s"""
|select *
|from temp_diary
|union all
|select *
|from temp_meigou
|union all
|select *
|from wiki_device_tag
""".stripMargin
)
final_train.show()
println("开始写入")
GmeiConfig.writeToJDBCTable("jdbc:mysql://172.16.40.158:4000/jerry_prod?user=root&password=3SYz54LS9#^9sBvC&rewriteBatchedStatements=true",final_train, table="icon_train_data_test",SaveMode.Append)
GmeiConfig.writeToJDBCTable("jdbc:mysql://172.16.40.158:4000/jerry_prod?user=root&password=3SYz54LS9#^9sBvC&rewriteBatchedStatements=true",final_train, table="icon_train_data",SaveMode.Append)
println("写入完成")
......@@ -898,9 +919,7 @@ object test_data {
|where b.tag_id is not null
""".stripMargin
)
wiki_device_tag.show()
wiki_device_tag.createOrReplaceTempView("wiki_device_tag")
}
......
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