This is an automated email from the ASF dual-hosted git repository.
tyrantlucifer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 2734557fb [Hotfix][Zeta] Fix parse job mode bug and improve doc (#4091)
2734557fb is described below
commit 2734557fb5a14824a6289149e96da7dc8082f1e3
Author: Tyrantlucifer <[email protected]>
AuthorDate: Thu Feb 9 18:10:32 2023 +0800
[Hotfix][Zeta] Fix parse job mode bug and improve doc (#4091)
* [Hotfix][Zeta] Fix the bug that parse job mode
* [Improve][Docs] Optimize docs
---
docs/en/concept/config.md | 54 +++++++++++++++++++++-
.../engine/core/parse/JobConfigParser.java | 3 +-
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/docs/en/concept/config.md b/docs/en/concept/config.md
index ba49606e6..2e74a8a65 100644
--- a/docs/en/concept/config.md
+++ b/docs/en/concept/config.md
@@ -8,6 +8,10 @@ In SeaTunnel, the most important thing is the Config file,
through which users c
synchronization requirements to maximize the potential of SeaTunnel. So next,
I will introduce you how to
configure the Config file.
+The main format of the Config file is `hocon`, for more details of this format
type you can refer to
[HOCON-GUIDE](https://github.com/lightbend/config/blob/main/HOCON.md),
+BTW, we also support the `json` format, but you should know that the name of
the config file should end with `.json`
+
+
## Example
Before you read on, you can find config file
@@ -18,6 +22,8 @@ config directory.
The Config file will be similar to the one below.
+### hocon
+
```hocon
env {
job.mode = "BATCH"
@@ -58,6 +64,52 @@ sink {
}
```
+### json
+
+```json
+
+{
+ "env": {
+ "job.mode": "batch"
+ },
+ "source": [
+ {
+ "plugin_name": "FakeSource",
+ "result_table_name": "fake",
+ "row.num": 100,
+ "schema": {
+ "fields": {
+ "name": "string",
+ "age": "int",
+ "card": "int"
+ }
+ }
+ }
+ ],
+ "transform": [
+ {
+ "plugin_name": "Filter",
+ "source_table_name": "fake",
+ "result_table_name": "fake1",
+ "fields": ["name", "card"]
+ }
+ ],
+ "sink": [
+ {
+ "plugin_name": "Clickhouse",
+ "host": "clickhouse:8123",
+ "database": "default",
+ "table": "seatunnel_console",
+ "fields": ["name", "card"],
+ "username": "default",
+ "password": "",
+ "source_table_name": "fake1"
+ }
+ ]
+}
+
+```
+
As you can see, the Config file contains several sections: env, source,
transform, sink. Different modules
have different functions. After you understand these modules, you will
understand how SeaTunnel works.
@@ -107,7 +159,7 @@ sink {
host = "clickhouse:8123"
database = "default"
table = "seatunnel_console"
- fields = ["name", "age", card"]
+ fields = ["name", "age", "card"]
username = "default"
password = ""
source_table_name = "fake1"
diff --git
a/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/JobConfigParser.java
b/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/JobConfigParser.java
index a322bd374..e972aab51 100644
---
a/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/JobConfigParser.java
+++
b/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/JobConfigParser.java
@@ -144,7 +144,8 @@ public class JobConfigParser {
private void jobConfigAnalyze(@NonNull Config envConfigs) {
if (envConfigs.hasPath(EnvCommonOptions.JOB_MODE.key())) {
-
jobConfig.getJobContext().setJobMode(envConfigs.getEnum(JobMode.class,
EnvCommonOptions.JOB_MODE.key()));
+ String jobMode =
envConfigs.getString(EnvCommonOptions.JOB_MODE.key());
+
jobConfig.getJobContext().setJobMode(JobMode.valueOf(jobMode.toUpperCase()));
} else {
jobConfig.getJobContext().setJobMode(EnvCommonOptions.JOB_MODE.defaultValue());
}