Commit a0e73dd2 authored by 高雅喆's avatar 高雅喆

add date param

parent fccb3d72
......@@ -43,15 +43,16 @@ object WeafareStat {
ti.tidbMapTable(dbName = "jerry_prod",tableName = "diary_video")
ti.tidbMapTable(dbName = "jerry_prod",tableName = "data_feed_click")
import sc.implicits._
val stat_date = GmeiConfig.getMinusNDate(1)
println(stat_date)
val video_cids = sc.sql(
s"""
|select distinct(cid_id) as cid_id
|from data_feed_click
|where cid_type = 'diary'
|and cid_id in (select cid from diary_video where stat_date='2018-10-17')
|and stat_date ='2018-10-17'
|and cid_id in (select cid from diary_video where stat_date='${stat_date}')
|and stat_date ='${stat_date}'
""".stripMargin
)
video_cids.show()
......@@ -62,19 +63,21 @@ object WeafareStat {
|select distinct(cid_id) as cid_id
|from data_feed_click
|where cid_type = 'diary'
|and cid_id not in (select cid from diary_video where stat_date='2018-10-17')
|and stat_date ='2018-10-17'
|and cid_id not in (select cid from diary_video where stat_date='${stat_date}')
|and stat_date ='${stat_date}'
""".stripMargin
)
txt_cids.show()
txt_cids.createOrReplaceTempView("tmp2")
val partition_date = stat_date.replace("-","")
println(partition_date)
val video_count = sc.sql(
s"""
|select count(page_name) as vd_count
|from online.bl_hdfs_page_view_updates pv inner join tmp1
|on pv.referrer_id = tmp1.cid_id
|where pv.partition_date = '20181017'
|where pv.partition_date = '${partition_date}'
|and pv.page_name='welfare_detail'
|and pv.referrer='diary_detail'
""".stripMargin
......@@ -90,7 +93,7 @@ object WeafareStat {
|select count(page_name) as txt_count
|from online.bl_hdfs_page_view_updates pv inner join tmp2
|on pv.referrer_id = tmp2.cid_id
|where pv.partition_date = '20181017'
|where pv.partition_date = '${partition_date}'
|and pv.page_name='welfare_detail'
|and pv.referrer='diary_detail'
""".stripMargin
......
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