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/06 10:01:27 UTC
[GitHub] [incubator-seatunnel] EricJoy2048 opened a new pull request, #3885: [Feature][API] add savemode feature
EricJoy2048 opened a new pull request, #3885:
URL: https://github.com/apache/incubator-seatunnel/pull/3885
The API Code of https://github.com/apache/incubator-seatunnel/issues/3824
--
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] TaoZex commented on a diff in pull request #3885: [Feature][API] add savemode feature API
Posted by GitBox <gi...@apache.org>.
TaoZex commented on code in PR #3885:
URL: https://github.com/apache/incubator-seatunnel/pull/3885#discussion_r1063452104
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/FactoryUtil.java:
##########
@@ -174,4 +180,34 @@ public static OptionRule sourceFullOptionRule(@NonNull Factory factory) {
sourceOptionRule.getOptionalOptions().addAll(sourceCommonOptionRule.getOptionalOptions());
return sourceOptionRule;
}
+
+ /**
+ * This method is called by SeaTunnel Web to get the full option rule of a sink.
+ * @return
+ */
+ public static OptionRule sinkFullOptionRule(@NonNull TableSinkFactory factory) {
+ OptionRule sinkOptionRule = factory.optionRule();
+ if (sinkOptionRule == null) {
+ throw new FactoryException("sinkOptionRule can not be null");
+ }
+
+ try {
+ TableSink sink = factory.createSink(null);
+ if (SupportDataSaveMode.class.isAssignableFrom(sink.getClass())) {
+ SupportDataSaveMode supportDataSaveModeSink = (SupportDataSaveMode) sink;
+ Option<DataSaveMode> saveMode =
+ Options.key(SinkCommonOptions.DATA_SAVE_MODE)
+ .singleChoice(DataSaveMode.class, supportDataSaveModeSink.supportedDataSaveModeValues())
+ .noDefaultValue()
+ .withDescription("data save mode");
+ OptionRule sinkCommonOptionRule =
+ OptionRule.builder().required(saveMode).build();
+ sinkOptionRule.getOptionalOptions().addAll(sinkCommonOptionRule.getOptionalOptions());
+ }
+ } catch (UnsupportedOperationException e) {
+ LOG.warn("Add save mode option need sink connector support create sink by TableSinkFactory");
+ }
Review Comment:
Do we need to throw exception?
--
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] TaoZex commented on a diff in pull request #3885: [Feature][API] add savemode feature API
Posted by GitBox <gi...@apache.org>.
TaoZex commented on code in PR #3885:
URL: https://github.com/apache/incubator-seatunnel/pull/3885#discussion_r1064312054
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/FactoryUtil.java:
##########
@@ -174,4 +180,34 @@ public static OptionRule sourceFullOptionRule(@NonNull Factory factory) {
sourceOptionRule.getOptionalOptions().addAll(sourceCommonOptionRule.getOptionalOptions());
return sourceOptionRule;
}
+
+ /**
+ * This method is called by SeaTunnel Web to get the full option rule of a sink.
+ * @return
+ */
+ public static OptionRule sinkFullOptionRule(@NonNull TableSinkFactory factory) {
+ OptionRule sinkOptionRule = factory.optionRule();
+ if (sinkOptionRule == null) {
+ throw new FactoryException("sinkOptionRule can not be null");
+ }
+
+ try {
+ TableSink sink = factory.createSink(null);
+ if (SupportDataSaveMode.class.isAssignableFrom(sink.getClass())) {
+ SupportDataSaveMode supportDataSaveModeSink = (SupportDataSaveMode) sink;
+ Option<DataSaveMode> saveMode =
+ Options.key(SinkCommonOptions.DATA_SAVE_MODE)
+ .singleChoice(DataSaveMode.class, supportDataSaveModeSink.supportedDataSaveModeValues())
+ .noDefaultValue()
+ .withDescription("data save mode");
+ OptionRule sinkCommonOptionRule =
+ OptionRule.builder().required(saveMode).build();
+ sinkOptionRule.getOptionalOptions().addAll(sinkCommonOptionRule.getOptionalOptions());
+ }
+ } catch (UnsupportedOperationException e) {
+ LOG.warn("Add save mode option need sink connector support create sink by TableSinkFactory");
+ }
Review Comment:
Good advice.Thanks for your reply.
--
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 #3885: [Feature][API] add savemode feature API
Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #3885:
URL: https://github.com/apache/incubator-seatunnel/pull/3885#discussion_r1064311301
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/FactoryUtil.java:
##########
@@ -174,4 +180,34 @@ public static OptionRule sourceFullOptionRule(@NonNull Factory factory) {
sourceOptionRule.getOptionalOptions().addAll(sourceCommonOptionRule.getOptionalOptions());
return sourceOptionRule;
}
+
+ /**
+ * This method is called by SeaTunnel Web to get the full option rule of a sink.
+ * @return
+ */
+ public static OptionRule sinkFullOptionRule(@NonNull TableSinkFactory factory) {
+ OptionRule sinkOptionRule = factory.optionRule();
+ if (sinkOptionRule == null) {
+ throw new FactoryException("sinkOptionRule can not be null");
+ }
+
+ try {
+ TableSink sink = factory.createSink(null);
+ if (SupportDataSaveMode.class.isAssignableFrom(sink.getClass())) {
+ SupportDataSaveMode supportDataSaveModeSink = (SupportDataSaveMode) sink;
+ Option<DataSaveMode> saveMode =
+ Options.key(SinkCommonOptions.DATA_SAVE_MODE)
+ .singleChoice(DataSaveMode.class, supportDataSaveModeSink.supportedDataSaveModeValues())
+ .noDefaultValue()
+ .withDescription("data save mode");
+ OptionRule sinkCommonOptionRule =
+ OptionRule.builder().required(saveMode).build();
+ sinkOptionRule.getOptionalOptions().addAll(sinkCommonOptionRule.getOptionalOptions());
+ }
+ } catch (UnsupportedOperationException e) {
+ LOG.warn("Add save mode option need sink connector support create sink by TableSinkFactory");
+ }
Review Comment:
I suggest not. Because It means all connectors need update when throw exception here. We can do it after all connector modify finished.
--
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] liugddx merged pull request #3885: [Feature][API] add savemode feature API
Posted by GitBox <gi...@apache.org>.
liugddx merged PR #3885:
URL: https://github.com/apache/incubator-seatunnel/pull/3885
--
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