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/09/05 15:21:01 UTC
[GitHub] [incubator-seatunnel] TyrantLucifer opened a new pull request, #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
TyrantLucifer opened a new pull request, #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655
<!--
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
According to pr #2555 , this pr has optimized the local file sink connector on top of it
<!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
## Check list
* [x] 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
--
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 #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#discussion_r963313933
##########
seatunnel-connectors-v2/connector-file/connector-file-local/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/local/sink/LocalFileSink.java:
##########
@@ -17,16 +17,26 @@
package org.apache.seatunnel.connectors.seatunnel.file.local.sink;
+import org.apache.seatunnel.api.common.PrepareFailException;
import org.apache.seatunnel.api.sink.SeaTunnelSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.AbstractFileSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.spi.SinkFileSystemPlugin;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.BaseFileSink;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
import com.google.auto.service.AutoService;
@AutoService(SeaTunnelSink.class)
-public class LocalFileSink extends AbstractFileSink {
+public class LocalFileSink extends BaseFileSink {
+
+ @Override
+ public String getPluginName() {
+ return FileSystemType.LOCAL.getFileSystemPluginName();
+ }
+
@Override
- public SinkFileSystemPlugin getSinkFileSystemPlugin() {
- return new LocalFileSinkPlugin();
+ public void prepare(Config pluginConfig) throws PrepareFailException {
+ super.prepare(pluginConfig);
+ hadoopConf = null;
Review Comment:
Done. Plese take a look.
--
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] ashulin commented on a diff in pull request #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
ashulin commented on code in PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#discussion_r963026797
##########
seatunnel-connectors-v2/connector-file/connector-file-local/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/local/sink/LocalFileSink.java:
##########
@@ -17,16 +17,26 @@
package org.apache.seatunnel.connectors.seatunnel.file.local.sink;
+import org.apache.seatunnel.api.common.PrepareFailException;
import org.apache.seatunnel.api.sink.SeaTunnelSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.AbstractFileSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.spi.SinkFileSystemPlugin;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.BaseFileSink;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
import com.google.auto.service.AutoService;
@AutoService(SeaTunnelSink.class)
-public class LocalFileSink extends AbstractFileSink {
+public class LocalFileSink extends BaseFileSink {
+
+ @Override
+ public String getPluginName() {
+ return FileSystemType.LOCAL.getFileSystemPluginName();
+ }
+
@Override
- public SinkFileSystemPlugin getSinkFileSystemPlugin() {
- return new LocalFileSinkPlugin();
+ public void prepare(Config pluginConfig) throws PrepareFailException {
+ super.prepare(pluginConfig);
+ hadoopConf = null;
Review Comment:
```suggestion
```
hadoopConf is automatically initialized to null, and there is no assignment to it in BaseFileSink.
--
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 a diff in pull request #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#discussion_r963297469
##########
seatunnel-connectors-v2/connector-file/connector-file-local/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/local/sink/LocalFileSink.java:
##########
@@ -17,16 +17,26 @@
package org.apache.seatunnel.connectors.seatunnel.file.local.sink;
+import org.apache.seatunnel.api.common.PrepareFailException;
import org.apache.seatunnel.api.sink.SeaTunnelSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.AbstractFileSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.spi.SinkFileSystemPlugin;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.BaseFileSink;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
import com.google.auto.service.AutoService;
@AutoService(SeaTunnelSink.class)
-public class LocalFileSink extends AbstractFileSink {
+public class LocalFileSink extends BaseFileSink {
+
+ @Override
+ public String getPluginName() {
+ return FileSystemType.LOCAL.getFileSystemPluginName();
+ }
+
@Override
- public SinkFileSystemPlugin getSinkFileSystemPlugin() {
- return new LocalFileSinkPlugin();
+ public void prepare(Config pluginConfig) throws PrepareFailException {
+ super.prepare(pluginConfig);
+ hadoopConf = null;
Review Comment:
> Yes, this is because the local file system needs to generate an empty `Configuration` object and does not need the help of a `HadoopConf` object.
>
> But there is another approach, instantiate HadoopConf, the property fsHdfsImpl set to `org.apache.hadoop.fs.LocalFileSystem`.
>
> Which of these two options do you think is better?
Because currently all file systems are accessed through HDFS protocol. So I think `But there is another approach, instantiate HadoopConf, the property fsHdfsImpl set to org.apache.hadoop.fs.LocalFileSystem` is better. This makes the overall design look clearer.
--
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 #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#issuecomment-1237200696
@CalvinKirs @EricJoy2048 PTAL.
--
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 #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#issuecomment-1237200340
@CalvinKirs @EricJoy2048 PTAL.
--
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 merged pull request #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
EricJoy2048 merged PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655
--
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 #2655: [Improve][Connector-V2] Refactor local file sink connector code structure
Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #2655:
URL: https://github.com/apache/incubator-seatunnel/pull/2655#discussion_r963033858
##########
seatunnel-connectors-v2/connector-file/connector-file-local/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/local/sink/LocalFileSink.java:
##########
@@ -17,16 +17,26 @@
package org.apache.seatunnel.connectors.seatunnel.file.local.sink;
+import org.apache.seatunnel.api.common.PrepareFailException;
import org.apache.seatunnel.api.sink.SeaTunnelSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.AbstractFileSink;
-import org.apache.seatunnel.connectors.seatunnel.file.sink.spi.SinkFileSystemPlugin;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileSystemType;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.BaseFileSink;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
import com.google.auto.service.AutoService;
@AutoService(SeaTunnelSink.class)
-public class LocalFileSink extends AbstractFileSink {
+public class LocalFileSink extends BaseFileSink {
+
+ @Override
+ public String getPluginName() {
+ return FileSystemType.LOCAL.getFileSystemPluginName();
+ }
+
@Override
- public SinkFileSystemPlugin getSinkFileSystemPlugin() {
- return new LocalFileSinkPlugin();
+ public void prepare(Config pluginConfig) throws PrepareFailException {
+ super.prepare(pluginConfig);
+ hadoopConf = null;
Review Comment:
Yes, this is because the local file system needs to generate an empty `Configuration` object and does not need the help of a `HadoopConf` object.
But there is another approach, instantiate HadoopConf, the property fsHdfsImpl set to `org.apache.hadoop.fs.LocalFileSystem`.
Which of these two options do you think is better?
--
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