|select device_id,concat_ws(':',level1_id,'0.25') as level1_value,concat_ws(':',level2_id,'0.5') as level2_value,concat_ws(':',level3_id,'1') as level3_value
|from diary_tag_detail
""".stripMargin
)
temp_diary.createOrReplaceTempView("temp_diary")
valtest_diary=sc.sql(
s"""
|select device_id,concat_ws(',',level1_value,level2_value,level3_value) as tag_list
|from temp_diary
""".stripMargin
)
test_diary.show()
// val df_explode = test_diary.withColumn("e", explode(split(test_diary['tag_list'], ","))).drop("tag_list")