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

过滤异常数据

parent 3053f82a
......@@ -68,7 +68,7 @@ object Search_keywords_count {
|select params['query'] as search_keywords
|from online.tl_hdfs_maidian_view
|where (action = 'do_search' or action = 'search_result_click_search')
|and partition_date ='${partition_date}'
|and partition_date ='20190107'
""".stripMargin
)
//搜索次数统计
......@@ -82,17 +82,15 @@ object Search_keywords_count {
)
search_count.show()
val get_result =search_keywords.rdd.map(x=>Try(x.toString())).filter(_.isFailure).map((_, 1)).reduceByKey(_ + _)
val get_result =search_keywords.rdd.map((_, 1)).reduceByKey(_ + _)
.sortBy(_._2,false)
val temp=get_result.collect()
for (i <- 0 until temp.length ) {
println(temp(i))
}
}
}
}
\ No newline at end of file
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