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

统计like项目

parent c4492dd8
...@@ -604,10 +604,9 @@ object alpha_ctr { ...@@ -604,10 +604,9 @@ object alpha_ctr {
|and partition_day='${partition_date}' |and partition_day='${partition_date}'
""".stripMargin """.stripMargin
) )
val a =expoure_cards.rdd.map(row => row(0).toString).map(row=>{ val a =expoure_cards.rdd.map(row => row(0).toString).map(row=>parse_json(row)).collect().sum
val lenth=parse_json(row) val result1=List((stat_date,a))
(stat_date,lenth) val df1 = sc.createDataFrame(result1).toDF("stat_date","expoure_count_recommend")
}).reduceByKey((x,y) => x + y).toDF("stat_date","exposure_count_recommend")
val expoure_cards2=sc.sql( val expoure_cards2=sc.sql(
s""" s"""
...@@ -619,15 +618,15 @@ object alpha_ctr { ...@@ -619,15 +618,15 @@ object alpha_ctr {
|and partition_day='${partition_date}' |and partition_day='${partition_date}'
""".stripMargin """.stripMargin
) )
val b =expoure_cards2.rdd.map(row => row(0).toString).map(row=>{ val b =expoure_cards2.rdd.map(row => row(0).toString).map(row=>parse_json(row)).collect().sum
val lenth=parse_json(row) val result2=List((stat_date,b))
(stat_date,lenth) val df2 = sc.createDataFrame(result2).toDF("stat_date","expoure_count_focus")
}).reduceByKey((x,y) => x + y).toDF("stat_date","exposure_count_focus")
val result=click_count_recommend.join(click_count_focus,"stat_date") val result=click_count_recommend.join(click_count_focus,"stat_date")
.join(a,"stat_date") .join(df1,"stat_date")
.join(b,"stat_date") .join(df2,"stat_date")
......
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