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

change sql

parent 62841705
......@@ -47,18 +47,20 @@ object testt {
ti.tidbMapTable(dbName = "jerry_prod", tableName = "blacklist")
ti.tidbMapTable(dbName = "jerry_test", tableName = "bl_device_list")
ti.tidbMapTable(dbName = "jerry_prod", tableName = "data_feed_exposure")
ti.tidbMapTable(dbName = "online", tableName = "tl_hdfs_maidian_view")
val strategies = Seq("3$","4$","5$","6$","7$","8$","c$","d$","e$","A$","B$","C$","D$")
for (strategy <- strategies){
println(strategy)
val get_data_dura = sc.sql(
s"""
|select count(cid_id) as get_clk_count_newUser
|from data_feed_click
|where (cid_type = 'diary' or cid_type = 'diary_video')
|and device_id regexp'${strategy}'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
|select partition_date, sum(params['duration']) as total_dur,count(distinct(cl_id)) as num
|from online.tl_hdfs_maidian_view
|where action="on_app_session_over"
|and cl_id regexp'${strategy}'
|and params['duration']>=0 and params['duration']<86400
|and partition_date >='20180801'
|group by partition_date order by partition_date desc
""".stripMargin
)
get_data_dura.show()
......
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