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

add date param

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