Commit 8e7da259 authored by 王志伟's avatar 王志伟

更改时间

parent ae599471
......@@ -710,32 +710,19 @@ object tag_value {
val level_index_temp=sc.sql(
s"""
|select a.tag_id,b.level1_id,b.level2_id,b.level3_id
|from online.tl_hdfs_diary_tags_view a
|left join online.bl_tag_hierarchy_detail b
|on a.tag_id = b.id
|where a.partition_date = '${partition_date}'
|and b.partition_date = '${partition_date}'
|select id as tag_id
|from online.bl_tag_hierarchy_detail
|where partition_date = '${partition_date}'
|and id !=0
""".stripMargin
)
level_index_temp.createOrReplaceTempView("level_index_temp")
val temp1=sc.sql(
s"""
|select tag_id,level1_id as level_id
|from level_index_temp
|union all
|select tag_id,level2_id as level_id
|from level_index_temp
|union all
|select tag_id,level3_id as level_id
|from level_index_temp
""".stripMargin
)
// temp1.createOrReplaceTempView("temp1")
// import implicit_
val result = temp1.select("tag_id").distinct().rdd.map{x => x.toString().substring(1,x.toString().length - 1)}.zipWithIndex().toDF("level_id","index")
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")
val test=result.select(result.col("level_id").cast(DoubleType).as("level_id"),result.col("index").cast(DoubleType).as("index"))
// val resDf = spark.createDataFrame(rowRdd)
......
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