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

取icon训练数据

parent 4c1ef90c
......@@ -534,6 +534,76 @@ object icon_train_data {
""".stripMargin
)
temp_diary.show()
temp_diary.createOrReplaceTempView("temp_diary")
// 美购点击数据
val meigou_click=sc.sql(
s"""
|select partition_date,cl_id as device_id, params['service_id'] as service_id
|from online.tl_hdfs_maidian_view
|where action = 'goto_welfare_detail'
|and partition_date='${partition_date}'
|and params['service_id'] is not null
""".stripMargin
)
meigou_click.show()
meigou_click.createOrReplaceTempView("meigou_click")
val meigou_tags = sc.sql(
s"""
|select * from online.tl_meigou_servicetag_view
|where partition_date = '${partition_date}'
""".stripMargin
)
meigou_tags.createOrReplaceTempView("meigou_tags")
val meigou_tag_detail = sc.sql(
s"""
|select a.*,b.tag_id,c.level1_id,c.level2_id,c.level3_id
|from meigou_click a
|left join meigou_tags b
|on a.service_id=b.service_id
|left join tag_hierarchy_detail c
|on b.tag_id=c.id
|where level1_id is not null
""".stripMargin
)
meigou_tag_detail.createOrReplaceTempView("meigou_tag_detail")
val temp_meigou = sc.sql(
s"""
|select '${stat_date}' as stat_date,device_id,tag_id,level1_id as level
|from diary_tag_detail
|union all
|select '${stat_date}' as stat_date,device_id,tag_id,level2_id as level
|from diary_tag_detail
|union all
|select '${stat_date}' as stat_date,device_id,tag_id,level3_id as level
|from diary_tag_detail
""".stripMargin
)
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 Df2 = test_diary.withColumn("tag_list",explode(split()))
......
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