Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
955255c1
Commit
955255c1
authored
Dec 03, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加新需求
parent
fd5abfad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
10 deletions
+50
-10
WeafareStat.scala
eda/feededa/src/main/scala/com/gmei/WeafareStat.scala
+50
-10
No files found.
eda/feededa/src/main/scala/com/gmei/WeafareStat.scala
View file @
955255c1
...
...
@@ -57,7 +57,7 @@ object WeafareStat {
|and stat_date ='${stat_date}'
"""
.
stripMargin
)
video_cids
.
show
()
//
video_cids.show()
video_cids
.
createOrReplaceTempView
(
"tmp1"
)
val
txt_cids
=
sc
.
sql
(
...
...
@@ -69,7 +69,7 @@ object WeafareStat {
|and stat_date ='${stat_date}'
"""
.
stripMargin
)
txt_cids
.
show
()
//
txt_cids.show()
txt_cids
.
createOrReplaceTempView
(
"tmp2"
)
val
partition_date
=
stat_date
.
replace
(
"-"
,
""
)
...
...
@@ -84,7 +84,7 @@ object WeafareStat {
|and pv.referrer='diary_detail'
"""
.
stripMargin
)
video_meigou_count
.
show
()
//
video_meigou_count.show()
val
txt_meigou_count
=
sc
.
sql
(
s
"""
...
...
@@ -96,7 +96,7 @@ object WeafareStat {
|and pv.referrer='diary_detail'
"""
.
stripMargin
)
txt_meigou_count
.
show
()
//
txt_meigou_count.show()
val
video_clk_count
=
sc
.
sql
(
s
"""
...
...
@@ -107,7 +107,7 @@ object WeafareStat {
|and stat_date='${stat_date}'
"""
.
stripMargin
)
video_clk_count
.
show
()
//
video_clk_count.show()
val
txt_clk_count
=
sc
.
sql
(
s
"""
...
...
@@ -118,7 +118,7 @@ object WeafareStat {
|and stat_date='${stat_date}'
"""
.
stripMargin
)
txt_clk_count
.
show
()
//
txt_clk_count.show()
val
video_count
=
sc
.
sql
(
s
"""
...
...
@@ -126,7 +126,7 @@ object WeafareStat {
|from diary_video where stat_date='${stat_date}'
"""
.
stripMargin
)
video_count
.
show
()
//
video_count.show()
val
vlog_meigou_clk_count
=
sc
.
sql
(
s
"""
...
...
@@ -138,7 +138,7 @@ object WeafareStat {
|and referrer_id in (select distinct(diary_id) from feed_diary_boost)
"""
.
stripMargin
)
vlog_meigou_clk_count
.
show
()
//
vlog_meigou_clk_count.show()
val
vlog_clk_count
=
sc
.
sql
(
...
...
@@ -150,7 +150,42 @@ object WeafareStat {
|and cid_id in (select distinct(diary_id) from feed_diary_boost)
"""
.
stripMargin
)
vlog_clk_count
.
show
()
// vlog_clk_count.show()
//日记本转化美购
//1.日记本到美购转化数
val
diary_meigou_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date, count(page_name) as diary_meigou_count
|from online.bl_hdfs_page_view_updates
|where partition_date = '${partition_date}'
|and page_name='welfare_detail'
|and referrer='diary_detail'
"""
.
stripMargin
)
//2.日记本点击数
val
diary_clk
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(cl_id) as diary_clk
|from online.tl_hdfs_maidian_view
|where action = 'on_click_diary_card'
|and cl_id != "NULL"
|and partition_date='${partition_date}'
"""
.
stripMargin
)
//3.日记本曝光数
val
diary_expoure
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(cl_id) as diary_expoure
|from online.ml_community_exposure_detail
|where business_type = "diary"
|and cl_id != "NULL"
|and partition_date='${partition_date}'
"""
.
stripMargin
)
val
result
=
video_clk_count
.
join
(
video_meigou_count
,
"stat_date"
)
...
...
@@ -159,13 +194,18 @@ object WeafareStat {
.
join
(
video_count
,
"stat_date"
)
.
join
(
vlog_meigou_clk_count
,
"stat_date"
)
.
join
(
vlog_clk_count
,
"stat_date"
)
.
join
(
diary_meigou_count
,
"stat_date"
)
.
join
(
diary_clk
,
"stat_date"
)
.
join
(
diary_expoure
,
"stat_date"
)
val
result1
=
result
.
withColumn
(
"video_meigou_rate"
,
result
.
col
(
"video_meigou_count"
)/
result
.
col
(
"video_clk_count"
))
val
result2
=
result1
.
withColumn
(
"txt_meigou_rate"
,
result
.
col
(
"txt_meigou_count"
)/
result
.
col
(
"txt_clk_count"
))
val
result3
=
result2
.
withColumn
(
"vlog_meigou_rate"
,
result
.
col
(
"vlog_meigou_clk_num"
)/
result
.
col
(
"vlog_clk_num"
))
val
result4
=
result3
.
withColumn
(
"diary_meigou_rate"
,
result
.
col
(
"diary_meigou_count"
)/
result
.
col
(
"diary_clk"
))
val
result5
=
result4
.
withColumn
(
"diary_expoure_meigou_rate"
,
result
.
col
(
"diary_meigou_count"
)/
result
.
col
(
"diary_expoure"
))
result
3
.
show
()
result
5
.
show
()
sc
.
stop
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment