Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mobvista-dmp
Project
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王金锋
mobvista-dmp
Commits
bcad12be
Commit
bcad12be
authored
Oct 19, 2021
by
WangJinfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update lazada_rtdmp,fix RTDmpFetch
parent
9d586698
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
RTDmpFetch.java
src/main/java/mobvista/dmp/datasource/rtdmp/RTDmpFetch.java
+2
-2
MySQLUtil.java
src/main/java/mobvista/dmp/util/MySQLUtil.java
+4
-1
ProcessRTJob.scala
...a/mobvista/dmp/datasource/rtdmp/lazada/ProcessRTJob.scala
+4
-0
No files found.
src/main/java/mobvista/dmp/datasource/rtdmp/RTDmpFetch.java
View file @
bcad12be
...
@@ -121,11 +121,11 @@ public class RTDmpFetch {
...
@@ -121,11 +121,11 @@ public class RTDmpFetch {
LOGGER
.
info
(
"checkRules -->> audienceId:"
+
audienceId
+
", jsonObject:"
+
jsonObject
+
", startTime:"
+
startTime
+
", endTime:"
+
endTime
);
LOGGER
.
info
(
"checkRules -->> audienceId:"
+
audienceId
+
", jsonObject:"
+
jsonObject
+
", startTime:"
+
startTime
+
", endTime:"
+
endTime
);
Tuple
tuple
=
checkRules
(
jsonObject
,
startTime
,
endTime
);
Tuple
tuple
=
checkRules
(
jsonObject
,
startTime
,
endTime
);
if
(
tuple
.
getFlag
())
{
if
(
tuple
.
getFlag
())
{
KV
kv
=
mySqlUtil
.
getPartitionTime
(
"dwh"
,
"
audience_merge_v1"
);
KV
kv
=
mySqlUtil
.
getPartitionTime
(
"dwh"
,
"audience_merge_v1"
);
// retry getPartitionTime
// retry getPartitionTime
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
if
(
StringUtils
.
isBlank
(
kv
.
getK
()))
{
if
(
StringUtils
.
isBlank
(
kv
.
getK
()))
{
kv
=
mySqlUtil
.
getPartitionTime
(
"dwh"
,
"
audience_merge_v1"
);
kv
=
mySqlUtil
.
getPartitionTime
(
"dwh"
,
"audience_merge_v1"
);
}
else
{
}
else
{
break
;
break
;
}
}
...
...
src/main/java/mobvista/dmp/util/MySQLUtil.java
View file @
bcad12be
...
@@ -78,8 +78,11 @@ public class MySQLUtil {
...
@@ -78,8 +78,11 @@ public class MySQLUtil {
stmt
=
conn
.
createStatement
();
stmt
=
conn
.
createStatement
();
String
sql
;
String
sql
;
// last partition
// last partition
sql
=
"SELECT part,utime FROM table_info WHERE db_name = '"
+
dbName
+
"' AND tb_name = '"
+
tbName
+
"' AND flag = 1 ORDER BY part DESC LIMIT 1"
;
sql
=
"SELECT part,utime FROM
dmp.
table_info WHERE db_name = '"
+
dbName
+
"' AND tb_name = '"
+
tbName
+
"' AND flag = 1 ORDER BY part DESC LIMIT 1"
;
ResultSet
rs
=
stmt
.
executeQuery
(
sql
);
ResultSet
rs
=
stmt
.
executeQuery
(
sql
);
if
(!
rs
.
next
())
{
System
.
out
.
println
(
"getPartitionTime Null,SQL --->>> "
+
sql
);
}
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
partition
=
rs
.
getString
(
"part"
);
partition
=
rs
.
getString
(
"part"
);
utime
=
rs
.
getTimestamp
(
"utime"
);
utime
=
rs
.
getTimestamp
(
"utime"
);
...
...
src/main/scala/mobvista/dmp/datasource/rtdmp/lazada/ProcessRTJob.scala
View file @
bcad12be
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.{JSONArray, JSONObject}
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.{JSONArray, JSONObject}
import
mobvista.dmp.common.
{
CommonSparkJob
,
MobvistaConstant
}
import
mobvista.dmp.common.
{
CommonSparkJob
,
MobvistaConstant
}
import
mobvista.dmp.datasource.rtdmp.
{
Logic
,
ServerUtil
}
import
mobvista.dmp.datasource.rtdmp.
{
Logic
,
ServerUtil
}
import
org.apache.commons.cli.
{
BasicParser
,
Options
}
import
org.apache.commons.cli.
{
BasicParser
,
Options
}
import
org.apache.hadoop.fs.
{
FileSystem
,
Path
}
import
org.apache.hadoop.io.compress.GzipCodec
import
org.apache.hadoop.io.compress.GzipCodec
import
java.net.URI
import
scala.collection.mutable
import
scala.collection.mutable
/**
/**
...
@@ -42,6 +44,8 @@ class ProcessRTJob extends CommonSparkJob with Serializable {
...
@@ -42,6 +44,8 @@ class ProcessRTJob extends CommonSparkJob with Serializable {
val
sql
:
String
=
Constant
.
process_rtdmp_audience_sql
val
sql
:
String
=
Constant
.
process_rtdmp_audience_sql
.
replace
(
"@dt"
,
dt
)
.
replace
(
"@dt"
,
dt
)
FileSystem
.
get
(
new
URI
(
s
"s3://mob-emr-test"
),
sc
.
hadoopConfiguration
).
delete
(
new
Path
(
output
),
true
)
spark
.
sql
(
sql
)
spark
.
sql
(
sql
)
.
rdd
.
map
(
row
=>
{
.
rdd
.
map
(
row
=>
{
row
.
getAs
[
String
](
"gaid"
)
row
.
getAs
[
String
](
"gaid"
)
...
...
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