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
c3caf28b
Commit
c3caf28b
authored
Jan 17, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计多天重复日记数量
parent
80bba4a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
temp_count.scala
eda/feededa/src/main/scala/com/gmei/temp_count.scala
+4
-4
No files found.
eda/feededa/src/main/scala/com/gmei/temp_count.scala
View file @
c3caf28b
...
...
@@ -304,13 +304,14 @@ object Repeated_content_recommendation_moreday {
// val stat_date = GmeiConfig.getMinusNDate(1)
val
stat_date
=
"2019-01-16"
//
val stat_date = "2019-01-16"
// val partition_date = stat_date.replace("-","")
val
now
=
new
Date
()
val
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
val
date
=
dateFormat
.
format
(
now
.
getTime
-
86400000L
*
15
)
val
today
=
dateFormat
.
format
(
now
)
val
exp_diary
=
sc
.
sql
(
...
...
@@ -318,8 +319,7 @@ object Repeated_content_recommendation_moreday {
|select stat_date,device_id,concat_ws(',',collect_set(distinct cid_id)) as expoure_diary
|from data_feed_exposure_precise
|where cid_type = 'diary'
|and stat_date >='2018-12-31'
|and stat_date <'2019-01-16'
|and stat_date >='${date}'
|group by device_id,stat_date
"""
.
stripMargin
).
rdd
.
map
(
row
=>(
row
(
0
).
toString
,
row
(
1
).
toString
,
row
(
2
).
toString
)).
map
(
row
=>(
row
.
_2
,
row
.
_3
)).
groupByKey
()
...
...
@@ -338,7 +338,7 @@ object Repeated_content_recommendation_moreday {
val
fenzi
=
count_imp
.
map
(
x
=>
x
.
_2
).
reduce
((
x
,
y
)
=>
x
+
y
)
val
repeated_rate
=
fenmu
/
fenzi
.
toDouble
val
result
=
List
((
stat_date
,
repeated_rate
))
val
result
=
List
((
today
,
repeated_rate
))
val
df_result
=
sc
.
createDataFrame
(
result
)
GmeiConfig
.
writeToJDBCTable
(
df_result
,
table
=
"Repeated_content_recommendation_moreday"
,
SaveMode
.
Append
)
...
...
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