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
1ec526a7
Commit
1ec526a7
authored
Dec 28, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GetDevicePortrait
parent
0506bc69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
EsmmData.scala
eda/feededa/src/main/scala/com/gmei/EsmmData.scala
+1
-1
GmeiConfig.scala
eda/feededa/src/main/scala/com/gmei/GmeiConfig.scala
+25
-2
No files found.
eda/feededa/src/main/scala/com/gmei/EsmmData.scala
View file @
1ec526a7
...
...
@@ -558,7 +558,7 @@ object GetDevicePortrait {
| on COALESCE(a.params['diary_id'], a.params['business_id'], 0) = b.diary_id
| where
| b.level1_ids is not null and
| a.partition_date = '
20181224
'
| a.partition_date = '
${stat_date}
'
| and (a.action = 'on_click_diary_card' or (a.action="full_stack_click_video_card_full_screen_play" and a.params["card_type"]="diary"))) c
|group by c.device_id,c.level1_id,c.stat_date
"""
.
stripMargin
...
...
eda/feededa/src/main/scala/com/gmei/GmeiConfig.scala
View file @
1ec526a7
...
...
@@ -3,11 +3,12 @@ package com.gmei
import
java.util.Properties
import
java.io.Serializable
import
java.sql.
{
Connection
,
DriverManager
}
import
java.text.SimpleDateFormat
import
java.util.
{
Calendar
}
import
java.util.
Calendar
import
com.typesafe.config._
import
org.apache.spark.
{
SparkConf
,
SparkContext
}
import
org.apache.spark.
{
SparkConf
,
SparkContext
}
import
org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions
import
org.apache.spark.sql.
{
DataFrame
,
SaveMode
,
SparkSession
}
...
...
@@ -77,6 +78,28 @@ object GmeiConfig extends Serializable {
}
def
updateDeviceFeat
(
iterator
:
Iterator
[(
String
,
String
,
String
,
String
)])
:
Unit
={
var
conn
:
Connection
=
null
var
ps
:
java.sql.PreparedStatement
=
null
val
sql
=
s
"replace into device_feat(device_id,stat_date,level1_id,level1_count) values(?,?,?,?)"
conn
=
DriverManager
.
getConnection
(
"jdbc:mysql://10.66.157.22:4000/jerry_prod"
,
"root"
,
"3SYz54LS9#^9sBvC"
)
ps
=
conn
.
prepareStatement
(
sql
)
try
{
iterator
.
foreach
(
x
=>
{
ps
.
setString
(
1
,
x
.
_1
)
ps
.
setString
(
2
,
x
.
_2
)
ps
.
setString
(
3
,
x
.
_3
)
ps
.
setString
(
4
,
x
.
_4
)
ps
.
executeUpdate
()
})
println
(
"update device feat done"
)
}
catch
{
case
_
=>
println
(
"update failed"
)
}
}
def
getMinusNDate
(
n
:
Int
)
:
String
={
var
dateFormat
:
SimpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
)
var
cal
:
Calendar
=
Calendar
.
getInstance
()
...
...
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