Commit 3437e476 authored by 王志伟's avatar 王志伟

统计app

parent 2bf4c078
...@@ -80,7 +80,8 @@ object app_list { ...@@ -80,7 +80,8 @@ object app_list {
| ,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100' | ,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100'
| ,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ' | ,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ'
| ,'promotion_shike','promotion_julang_jl03','','unknown','promotion_zuimei') | ,'promotion_shike','promotion_julang_jl03','','unknown','promotion_zuimei')
|and partition_date ='${partition_date}' |and partition_date >'20190430'
|and partition_date <'20190601'
""".stripMargin """.stripMargin
) )
device_id_newUser.createOrReplaceTempView("device_id_new") device_id_newUser.createOrReplaceTempView("device_id_new")
......
...@@ -893,8 +893,8 @@ object app_list_yunying { ...@@ -893,8 +893,8 @@ object app_list_yunying {
val device_id_newUser = sc.sql( val device_id_newUser = sc.sql(
s""" s"""
|select distinct(device_id) as device_id |select distinct(device_id) as device_id
|from online.ml_device_day_active_status |from online.ml_device_month_active_status
|where (active_type = '1' or active_type='2') |where active_type != '4'
|and first_channel_source_type not in ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3' |and first_channel_source_type not in ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3'
| ,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang' | ,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang'
| ,'js-az1','js-az2','js-az3','js-az4','js-az5','jfq-az1','jfq-az2','jfq-az3','jfq-az4','jfq-az5','toufang1' | ,'js-az1','js-az2','js-az3','js-az4','js-az5','jfq-az1','jfq-az2','jfq-az3','jfq-az4','jfq-az5','toufang1'
...@@ -902,26 +902,41 @@ object app_list_yunying { ...@@ -902,26 +902,41 @@ object app_list_yunying {
| ,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100' | ,'TF-toufang5','tf-toufang1','tf-toufang2','tf-toufang3','tf-toufang4','tf-toufang5','benzhan','promotion_aso100'
| ,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ' | ,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ'
| ,'promotion_shike','promotion_julang_jl03','','unknown','promotion_zuimei') | ,'promotion_shike','promotion_julang_jl03','','unknown','promotion_zuimei')
|and partition_date ='${partition_date}' |and partition_date ='20190531'
""".stripMargin """.stripMargin
) )
device_id_newUser.createOrReplaceTempView("device_id_new") device_id_newUser.createOrReplaceTempView("device_id_new")
val app_list = sc.sql( val app_list = sc.sql(
s""" s"""
|select '${stat_date}' as stat_date,channel,a.params['installed_app_info'] as app_list |select *
|from online.tl_hdfs_maidian_view a |from
|(select cl_id,
| time_stamp,
| params['installed_app_info'] as app_list,
| row_number() over (partition by cl_id order by time_stamp desc) as pk
| from online.tl_hdfs_maidian_view
|where partition_date ='20190522'
| and action = 'user_installed_all_app_info'
| and cl_type='android'
| ) a
|where a.pk = 1
""".stripMargin
)
app_list.createOrReplaceTempView("app_list")
val final_app_list = sc.sql(
s"""
|select *
|from
|app_list a
|inner join device_id_new b |inner join device_id_new b
|on a.cl_id=b.device_id |on a.cl_id=b.device_id
|where a.partition_date ='${partition_date}'
|and a.action='user_installed_all_app_info'
|and a.cl_type='android'
""".stripMargin """.stripMargin
) )
app_list.show()
val result1 = app_list val result1 = final_app_list
result1.show() result1.show()
println("开始写入") println("开始写入")
......
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