You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2023/01/07 17:17:51 UTC

[GitHub] [incubator-seatunnel] sunnyzhu92 opened a new pull request, #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

sunnyzhu92 opened a new pull request, #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896

   
   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   [#3823](https://github.com/apache/incubator-seatunnel/issues/3823)
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/incubator-seatunnel/tree/dev/docs/en/connector-v2)
     2. Update [plugin-mapping.properties](https://github.com/apache/incubator-seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     3. Update the pom file of [seatunnel-dist](https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-dist/pom.xml)
   * [ ] Update the [`release-note`](https://github.com/apache/incubator-seatunnel/blob/dev/release-note.md).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071303288


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -77,8 +77,13 @@ public void prepare(Config pluginConfig) throws PrepareFailException {
                 );
             }
         }
-        SeaTunnelSchema seatunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig);
-        this.typeInfo = seatunnelSchema.getSeaTunnelRowType();
+        if (pluginConfig.hasPath(SeaTunnelSchema.SCHEMA.key())) {

Review Comment:
   Schema is a required key of connector, so if the user does not configured it connector should throw exception. You can refer to #3897 . Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] sunnyzhu92 commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
sunnyzhu92 commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071816091


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -65,21 +65,29 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
-        if (!result.isSuccess()) {
-            result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
-
-            if (!result.isSuccess()) {
-                throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
-                    String.format("PluginName: %s, PluginType: %s, Message: %s",
-                        getPluginName(), PluginType.SOURCE,
-                        result.getMsg())
-                );
-            }
+        CheckResult urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
+        if (!urlCheckResult.isSuccess()) {
+            urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
+        }
+        CheckResult schemaCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, SeaTunnelSchema.SCHEMA.key());
+        CheckResult mergedConfigCheck = CheckConfigUtil.mergeCheckResults(urlCheckResult, schemaCheckResult);
+        if (!mergedConfigCheck.isSuccess()) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE,
+                    mergedConfigCheck.getMsg())
+            );
+        }
+        try {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+            pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
+        } catch (Exception e) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE, e)
+            );
         }

Review Comment:
   @TyrantLucifer Thanks for your suggestions.I have done this.



##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSourceFactory.java:
##########
@@ -49,7 +50,7 @@ public String factoryIdentifier() {
     @Override
     public OptionRule optionRule() {
         return OptionRule.builder()
-                .required(NODE_URLS, USERNAME, PASSWORD, SQL)
+                .required(NODE_URLS, USERNAME, PASSWORD, SQL, SeaTunnelSchema.SCHEMA)

Review Comment:
   @TyrantLucifer Thanks for your suggestions.I have done this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071303288


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -77,8 +77,13 @@ public void prepare(Config pluginConfig) throws PrepareFailException {
                 );
             }
         }
-        SeaTunnelSchema seatunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig);
-        this.typeInfo = seatunnelSchema.getSeaTunnelRowType();
+        if (pluginConfig.hasPath(SeaTunnelSchema.SCHEMA.key())) {

Review Comment:
   Schema is a required key of connector, so if the user does not configured it connector should throw exception. You can refer to #3947. Thanks!



##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -77,8 +77,13 @@ public void prepare(Config pluginConfig) throws PrepareFailException {
                 );
             }
         }
-        SeaTunnelSchema seatunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig);
-        this.typeInfo = seatunnelSchema.getSeaTunnelRowType();
+        if (pluginConfig.hasPath(SeaTunnelSchema.SCHEMA.key())) {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+        } else {

Review Comment:
   Remove else branch.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 closed pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
EricJoy2048 closed pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…
URL: https://github.com/apache/incubator-seatunnel/pull/3896


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1384944790

   > > LGTM, thank you for your contirbution. Looking forward your next pull request! BTW, before this pr be merged CI should be passed. Let's waiting CI. cc @hailin0 @Hisoka-X @EricJoy2048 @CalvinKirs↳
   > 
   > I have one question, like this #3959
   
   Unified parameters is convenient for frontend display the parameters. Do I understand right? @EricJoy2048 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] sunnyzhu92 commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
sunnyzhu92 commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1379889782

   > TBD: doc
   
   Thanks for your suggestions!I have updated doc and checked code style with docs/contribution/coding-guide.md. Can you help to approve the ci workflows again, since this is my first-time contribution. Thanks very much!  @CalvinKirs 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1380371993

   Thank you for your contribution. Let's waiting CI process.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071750702


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -65,21 +65,29 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
-        if (!result.isSuccess()) {
-            result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
-
-            if (!result.isSuccess()) {
-                throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
-                    String.format("PluginName: %s, PluginType: %s, Message: %s",
-                        getPluginName(), PluginType.SOURCE,
-                        result.getMsg())
-                );
-            }
+        CheckResult urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
+        if (!urlCheckResult.isSuccess()) {
+            urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
+        }
+        CheckResult schemaCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, SeaTunnelSchema.SCHEMA.key());
+        CheckResult mergedConfigCheck = CheckConfigUtil.mergeCheckResults(urlCheckResult, schemaCheckResult);
+        if (!mergedConfigCheck.isSuccess()) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE,
+                    mergedConfigCheck.getMsg())
+            );
+        }
+        try {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+            pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
+        } catch (Exception e) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE, e)
+            );
         }

Review Comment:
   ```suggestion
           SeaTunnelSchema seatunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig);
           this.typeInfo = seatunnelSchema.getSeaTunnelRowType();
           pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
   ```



##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSourceFactory.java:
##########
@@ -49,7 +50,7 @@ public String factoryIdentifier() {
     @Override
     public OptionRule optionRule() {
         return OptionRule.builder()
-                .required(NODE_URLS, USERNAME, PASSWORD, SQL)
+                .required(NODE_URLS, USERNAME, PASSWORD, SQL, SeaTunnelSchema.SCHEMA)

Review Comment:
   static import is better



##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -65,21 +65,29 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
-        if (!result.isSuccess()) {
-            result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
-
-            if (!result.isSuccess()) {
-                throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
-                    String.format("PluginName: %s, PluginType: %s, Message: %s",
-                        getPluginName(), PluginType.SOURCE,
-                        result.getMsg())
-                );
-            }
+        CheckResult urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
+        if (!urlCheckResult.isSuccess()) {
+            urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
+        }
+        CheckResult schemaCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, SeaTunnelSchema.SCHEMA.key());
+        CheckResult mergedConfigCheck = CheckConfigUtil.mergeCheckResults(urlCheckResult, schemaCheckResult);
+        if (!mergedConfigCheck.isSuccess()) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE,
+                    mergedConfigCheck.getMsg())
+            );
+        }
+        try {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+            pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
+        } catch (Exception e) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE, e)
+            );
         }

Review Comment:
   Revert this logic. As is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071750702


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -65,21 +65,29 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
-        if (!result.isSuccess()) {
-            result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
-
-            if (!result.isSuccess()) {
-                throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
-                    String.format("PluginName: %s, PluginType: %s, Message: %s",
-                        getPluginName(), PluginType.SOURCE,
-                        result.getMsg())
-                );
-            }
+        CheckResult urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
+        if (!urlCheckResult.isSuccess()) {
+            urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
+        }
+        CheckResult schemaCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, SeaTunnelSchema.SCHEMA.key());
+        CheckResult mergedConfigCheck = CheckConfigUtil.mergeCheckResults(urlCheckResult, schemaCheckResult);
+        if (!mergedConfigCheck.isSuccess()) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE,
+                    mergedConfigCheck.getMsg())
+            );
+        }
+        try {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+            pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
+        } catch (Exception e) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE, e)
+            );
         }

Review Comment:
   ```suggestion
           SeaTunnelSchema seatunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key()));
           this.typeInfo = seatunnelSchema.getSeaTunnelRowType();
           pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] CalvinKirs commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1384942214

   > LGTM, thank you for your contirbution. Looking forward your next pull request! BTW, before this pr be merged CI should be passed. Let's waiting CI. cc @hailin0 @Hisoka-X @EricJoy2048 @CalvinKirs↳
   
   I have one question, like this https://github.com/apache/incubator-seatunnel/pull/3959


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#discussion_r1071750702


##########
seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSource.java:
##########
@@ -65,21 +65,29 @@ public String getPluginName() {
 
     @Override
     public void prepare(Config pluginConfig) throws PrepareFailException {
-        CheckResult result = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
-        if (!result.isSuccess()) {
-            result = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
-
-            if (!result.isSuccess()) {
-                throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
-                    String.format("PluginName: %s, PluginType: %s, Message: %s",
-                        getPluginName(), PluginType.SOURCE,
-                        result.getMsg())
-                );
-            }
+        CheckResult urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, HOST.key(), PORT.key());
+        if (!urlCheckResult.isSuccess()) {
+            urlCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, NODE_URLS.key());
+        }
+        CheckResult schemaCheckResult = CheckConfigUtil.checkAllExists(pluginConfig, SeaTunnelSchema.SCHEMA.key());
+        CheckResult mergedConfigCheck = CheckConfigUtil.mergeCheckResults(urlCheckResult, schemaCheckResult);
+        if (!mergedConfigCheck.isSuccess()) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE,
+                    mergedConfigCheck.getMsg())
+            );
+        }
+        try {
+            Config schemaConfig = pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key());
+            this.typeInfo = SeaTunnelSchema.buildWithConfig(schemaConfig).getSeaTunnelRowType();
+            pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
+        } catch (Exception e) {
+            throw new IotdbConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
+                String.format("PluginName: %s, PluginType: %s, Message: %s",
+                    getPluginName(), PluginType.SOURCE, e)
+            );
         }

Review Comment:
   ```suggestion
           SeaTunnelSchema seaTunnelSchema = SeaTunnelSchema.buildWithConfig(pluginConfig.getConfig(SeaTunnelSchema.SCHEMA.key()));
           this.typeInfo = seaTunnelSchema.getSeaTunnelRowType();
           pluginConfig.entrySet().forEach(entry -> configParams.put(entry.getKey(), entry.getValue().unwrapped()));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1385053642

   > > > LGTM, thank you for your contirbution. Looking forward your next pull request! BTW, before this pr be merged CI should be passed. Let's waiting CI. cc @hailin0 @Hisoka-X @EricJoy2048 @CalvinKirs↳
   > > 
   > > 
   > > I have one question, like this #3959
   > 
   > Unified parameters is convenient for frontend display the parameters. Do I understand right? @EricJoy2048
   
   Yes, I like this pr. Thanks for your contirbution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] CalvinKirs commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1385138439

   > > > > LGTM, thank you for your contirbution. Looking forward your next pull request! BTW, before this pr be merged CI should be passed. Let's waiting CI. cc @hailin0 @Hisoka-X @EricJoy2048 @CalvinKirs↳↳
   > > > 
   > > > 
   > > > I have one question, like this #3959↳
   > > 
   > > 
   > > Unified parameters is convenient for frontend display the parameters. Do I understand right? @EricJoy2048↳
   > 
   > Yes, I like this pr. Thanks for your contirbution.↳
   
   I think you didn't get my point, what we need to consider is compatibility


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] wfrong commented on pull request #3896: [Improve][SourceConnector] Unified schema parameter, update IoTDB sou…

Posted by GitBox <gi...@apache.org>.
wfrong commented on PR #3896:
URL: https://github.com/apache/incubator-seatunnel/pull/3896#issuecomment-1385245942

   
   
   
   > > > > > LGTM, thank you for your contirbution. Looking forward your next pull request! BTW, before this pr be merged CI should be passed. Let's waiting CI. cc @hailin0 @Hisoka-X @EricJoy2048 @CalvinKirs↳↳
   > > > > 
   > > > > 
   > > > > I have one question, like this #3959↳
   > > > 
   > > > 
   > > > Unified parameters is convenient for frontend display the parameters. Do I understand right? @EricJoy2048↳
   > > 
   > > 
   > > Yes, I like this pr. Thanks for your contirbution.↳
   > 
   > I think you didn't get my point, what we need to consider is compatibility
   
   I think you mean we should support  previous usage only config fields without schema?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org