Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
ZHHT-IRN-BD-ANALYSIS
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
李凯旋
ZHHT-IRN-BD-ANALYSIS
Commits
6d8ed6d6
Commit
6d8ed6d6
authored
Jan 09, 2023
by
黄准
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车道指标相关计算逻辑
parent
3466d081
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
DorisUtils.java
...treaming/src/main/java/com/zhht/irn/utils/DorisUtils.java
+29
-0
No files found.
realtime/hologram-streaming/src/main/java/com/zhht/irn/utils/DorisUtils.java
View file @
6d8ed6d6
...
...
@@ -80,4 +80,33 @@ public class DorisUtils {
.
setDorisOptions
(
dorisBuilder
.
build
());
return
builder
;
}
public
static
DorisSink
.
Builder
<
String
>
getBuilder
(
String
filePath
,
String
label1
)
throws
IOException
{
DorisSink
.
Builder
<
String
>
builder
=
DorisSink
.
builder
();
DorisOptions
.
Builder
dorisBuilder
=
DorisOptions
.
builder
();
InputStream
inputStream
=
DorisUtils
.
class
.
getClassLoader
().
getResourceAsStream
(
filePath
);
ParameterTool
tool
=
ParameterTool
.
fromPropertiesFile
(
inputStream
);
// 根据路径的配置文件获取MySQL链接参数
String
username
=
tool
.
getRequired
(
"username"
);
String
password
=
tool
.
getRequired
(
"password"
);
String
host
=
tool
.
getRequired
(
"host"
);
String
port
=
tool
.
getRequired
(
"port"
);
String
database
=
tool
.
get
(
"database"
,
"default"
);
String
table
=
tool
.
getRequired
(
"table"
);
String
label
=
tool
.
getRequired
(
"label"
);
dorisBuilder
.
setFenodes
(
host
+
":"
+
port
)
.
setTableIdentifier
(
database
+
"."
+
table
)
.
setUsername
(
username
)
.
setPassword
(
password
);
DorisExecutionOptions
.
Builder
executionBuilder
=
DorisExecutionOptions
.
builder
();
executionBuilder
.
setLabelPrefix
(
StringUtils
.
isNotEmpty
(
label1
)?
label1:
label
);
// streamload label prefix
builder
.
setDorisReadOptions
(
DorisReadOptions
.
builder
().
build
())
.
setDorisExecutionOptions
(
executionBuilder
.
build
())
.
setSerializer
(
new
SimpleStringSerializer
())
//serialize according to string
.
setDorisOptions
(
dorisBuilder
.
build
());
return
builder
;
}
}
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