Commit 16a0593b authored by 王志伟's avatar 王志伟

统计icon数据

parent 61840c1f
...@@ -1083,7 +1083,7 @@ object icon_data { ...@@ -1083,7 +1083,7 @@ object icon_data {
//总体点击 //总体点击
val icon_click_all = sc.sql( val icon_click_all = sc.sql(
s""" s"""
|select count(*) as icon_click_num |select '${stat_date}' as stat_date,count(*) as icon_click_num
|from online.tl_hdfs_maidian_view |from online.tl_hdfs_maidian_view
|where partition_date='${partition_date}' |where partition_date='${partition_date}'
|and action='home_click_section' |and action='home_click_section'
...@@ -1095,7 +1095,7 @@ object icon_data { ...@@ -1095,7 +1095,7 @@ object icon_data {
//总体曝光 //总体曝光
val icon_expoure_all = sc.sql( val icon_expoure_all = sc.sql(
s""" s"""
|select count(*) as icon_expoure_num |select '${stat_date}' as stat_date,count(*) as icon_expoure_num
|from online.ml_community_exposure_detail_new |from online.ml_community_exposure_detail_new
|where partition_date='${partition_date}' |where partition_date='${partition_date}'
|and business_type='icon' |and business_type='icon'
...@@ -1108,7 +1108,7 @@ object icon_data { ...@@ -1108,7 +1108,7 @@ object icon_data {
//指定用户的点击 //指定用户的点击
val icon_click_device = sc.sql( val icon_click_device = sc.sql(
s""" s"""
|select count(*) as icon_click_num_device |select '${stat_date}' as stat_date,count(*) as icon_click_num_device
|from online.tl_hdfs_maidian_view a |from online.tl_hdfs_maidian_view a
|inner join device_id b |inner join device_id b
|on a.cl_id=b.device_id |on a.cl_id=b.device_id
...@@ -1121,7 +1121,7 @@ object icon_data { ...@@ -1121,7 +1121,7 @@ object icon_data {
//指定用户的曝光 //指定用户的曝光
val icon_expoure_device = sc.sql( val icon_expoure_device = sc.sql(
s""" s"""
|select count(*) as icon_expoure_num_device |select '${stat_date}' as stat_date,count(*) as icon_expoure_num_device
|from online.ml_community_exposure_detail_new a |from online.ml_community_exposure_detail_new a
|inner join device_id b |inner join device_id b
|on a.cl_id=b.device_id |on a.cl_id=b.device_id
...@@ -1129,9 +1129,22 @@ object icon_data { ...@@ -1129,9 +1129,22 @@ object icon_data {
|and a.business_type='icon' |and a.business_type='icon'
""".stripMargin """.stripMargin
) )
icon_expoure_all.createOrReplaceTempView("icon_expoure_all") icon_expoure_device.createOrReplaceTempView("icon_expoure_device")
icon_expoure_device.show() icon_expoure_device.show()
val result = icon_click_all.join(icon_expoure_all,"stat_date")
.join(icon_click_device,"stat_date")
.join(icon_expoure_device,"stat_date")
println("开始写入")
GmeiConfig.writeToJDBCTable("jdbc:mysql://172.16.40.158:4000/jerry_prod?user=root&password=3SYz54LS9#^9sBvC&rewriteBatchedStatements=true",result, table="icon_data",SaveMode.Append)
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