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 2022/03/20 08:02:26 UTC

[GitHub] [incubator-seatunnel] asdf2014 opened a new pull request #1523: [Improve] [core] Refactor creating plugin logic

asdf2014 opened a new pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523


   <!--
   
   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
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   This PR refactored creating plugin logic.
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] If any new Jar binary package adding in you PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/developement/NewLicenseGuide.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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] BenJFan commented on pull request #1523: [Improve] [core] Refactor creating plugin logic

Posted by GitBox <gi...@apache.org>.
BenJFan commented on pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523#issuecomment-1074685987


   I personally feel that this change does not really help the code structure. `createPluginInstanceIgnoreCase` use plugin name is simple, why now need send config?


-- 
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] ruanwenjun commented on a change in pull request #1523: [Improve] [core] Refactor creating plugin logic

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523#discussion_r833411112



##########
File path: seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/config/ConfigBuilder.java
##########
@@ -157,6 +158,7 @@ private boolean checkIsContainHive() {
                 String serviceClassName = serviceClass.getName();
                 String clsNameToLower = serviceClassName.toLowerCase();
                 if (clsNameToLower.equals(canonicalName.toLowerCase())) {
+                    plugin.setConfig(config);

Review comment:
       @asdf2014 I think it might be better to not set config in `createPluginInstanceIgnoreCase` method. From the method name, we can easy to know it just create a plugin instance, it doesn't reflect to do some other initialize operation.
   




-- 
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] asdf2014 commented on a change in pull request #1523: [Improve] [core] Refactor creating plugin logic

Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523#discussion_r832130338



##########
File path: seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/config/ConfigBuilder.java
##########
@@ -157,6 +158,7 @@ private boolean checkIsContainHive() {
                 String serviceClassName = serviceClass.getName();
                 String clsNameToLower = serviceClassName.toLowerCase();
                 if (clsNameToLower.equals(canonicalName.toLowerCase())) {
+                    plugin.setConfig(config);

Review comment:
       It would be better to pass object reference instead of value, which is more OOP style




-- 
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] asdf2014 commented on a change in pull request #1523: [Improve] [core] Refactor creating plugin logic

Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523#discussion_r831780855



##########
File path: seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/config/ConfigBuilder.java
##########
@@ -157,6 +158,7 @@ private boolean checkIsContainHive() {
                 String serviceClassName = serviceClass.getName();
                 String clsNameToLower = serviceClassName.toLowerCase();
                 if (clsNameToLower.equals(canonicalName.toLowerCase())) {
+                    plugin.setConfig(config);

Review comment:
       @BenJFan Because config will be used by plugin




-- 
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] BenJFan commented on a change in pull request #1523: [Improve] [core] Refactor creating plugin logic

Posted by GitBox <gi...@apache.org>.
BenJFan commented on a change in pull request #1523:
URL: https://github.com/apache/incubator-seatunnel/pull/1523#discussion_r831877512



##########
File path: seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/config/ConfigBuilder.java
##########
@@ -157,6 +158,7 @@ private boolean checkIsContainHive() {
                 String serviceClassName = serviceClass.getName();
                 String clsNameToLower = serviceClassName.toLowerCase();
                 if (clsNameToLower.equals(canonicalName.toLowerCase())) {
+                    plugin.setConfig(config);

Review comment:
       > @BenJFan Because config will be used by plugin
   
   Any problem with `plugin.setConfig` outside of `createPluginInstanceIgnoreCase` ?




-- 
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