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
26e113cb
Commit
26e113cb
authored
Oct 27, 2018
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vlog
parent
562be3e5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
WeafareStat.scala
eda/feededa/src/main/scala/com/gmei/WeafareStat.scala
+33
-3
No files found.
eda/feededa/src/main/scala/com/gmei/WeafareStat.scala
View file @
26e113cb
...
...
@@ -42,6 +42,7 @@ object WeafareStat {
val
ti
=
new
TiContext
(
sc
)
ti
.
tidbMapTable
(
dbName
=
"jerry_prod"
,
tableName
=
"diary_video"
)
ti
.
tidbMapTable
(
dbName
=
"jerry_prod"
,
tableName
=
"data_feed_click"
)
ti
.
tidbMapTable
(
dbName
=
"eagle"
,
tableName
=
"feed_diary_boost"
)
import
sc.implicits._
...
...
@@ -127,15 +128,44 @@ object WeafareStat {
)
video_count
.
show
()
val
vlog_meigou_clk_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(page_name) as vlog_meigou_clk_num
|from online.bl_hdfs_page_view_updates
|where partition_date='${partition_date}'
|and page_name='welfare_detail'
|and referrer='diary_detail'
|and referrer_id in (select distinct(diary_id) from feed_diary_boost)
"""
.
stripMargin
)
vlog_meigou_clk_count
.
show
()
val
vlog_clk_count
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,count(cid_id) as vlog_clk_num
|from jerry_prod.data_feed_click
|where stat_date='${stat_date}'
|and cid_type = 'diary'
|and cid_id in (select distinct(diary_id) from feed_diary_boost)
"""
.
stripMargin
)
vlog_clk_count
.
show
()
val
result
=
video_clk_count
.
join
(
video_meigou_count
,
"stat_date"
)
.
join
(
txt_clk_count
,
"stat_date"
)
.
join
(
txt_meigou_count
,
"stat_date"
)
.
join
(
video_count
,
"stat_date"
)
.
join
(
vlog_meigou_clk_count
,
"stat_date"
)
.
join
(
vlog_clk_count
,
"stat_date"
)
val
result1
=
result
.
withColumn
(
"video_rate"
,
result
.
col
(
"video_meigou_count"
)/
result
.
col
(
"video_clk_count"
))
val
result2
=
result1
.
withColumn
(
"txt_rate"
,
result
.
col
(
"txt_meigou_count"
)/
result
.
col
(
"txt_clk_count"
))
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"
))
result
2
.
show
()
result
3
.
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