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
f21a08ea
Commit
f21a08ea
authored
Mar 26, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计like项目
parent
c4492dd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
temp_analysis.scala
eda/feededa/src/main/scala/com/gmei/temp_analysis.scala
+9
-10
No files found.
eda/feededa/src/main/scala/com/gmei/temp_analysis.scala
View file @
f21a08ea
...
@@ -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"
)
...
...
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