-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature][Connector V2] Add SaveMode for All Sink Connector #3824
Comments
After discuss in #3851, I will update the design here. |
BackgroundCurrently, SeaTunnel's sink connector does not support the SaveMode function. So I create this issue and discuss how to add SaveMode feature to SeaTunnel. Unified SaveMode TypeI have checked all Sink connectors. At present, SaveMode can be unified into four modes.
Add interface for SaveModeI will add tow interface for SaveMode. SupportDataSaveModeThe Sink Connectors which support DataSaveMode should implement this interface
Add SaveMode Option to Sink ConnectorIn order to unify the parameter names of each Sink connector that supports SaveMode, I added a parameters about SaveMode.
Add a
Automatically add DataSaveMode Option to the OptionRule of each connector supported DataSaveModeTo do this, I add Please note that the
What stage should DataSaveMode be processedWe will call So I updated the starter code. org.apache.seatunnel.core.starter.flink.execution.SinkExecuteProcessor#initializePlugins
About handleSaveMode method and automatic create tableActually, it contains the semantics of creating schema in the whole life circle of data save mode, we can do the logic of automatic create table when invoke But what the best time to invoke this logic? As we know, if we want to implement the logic of automatic create table we need know the acually schema of sink connector, so invoke it after seaTunnelSink.setTypeInfo((SeaTunnelRowType) TypeConverterUtils.convert(stream.getType()));
if (seaTunnelSink.getClass().isAssignableFrom(SupportDataSaveMode.class)) {
SupportDataSaveMode saveModeSink = (SupportDataSaveMode) seaTunnelSink;
DataSaveMode dataSaveMode = saveModeSink.getDataSaveMode();
saveModeSink.handleSaveMode(dataSaveMode);
} About how to getting or modify metadataIn api modules, it has the interface Connector can implement theirs own void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists); related issue #3271 |
Does |
This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs. |
This issue has been closed because it has not received response for too long time. You could reopen it if you encountered similar problems in the future. |
Background
Currently, SeaTunnel's sink connector does not support the SaveMode function. So I create this issue and discuss how to add SaveMode feature to SeaTunnel.
Unified SaveMode Type
I have checked all Sink connectors. At present, SaveMode can be divided into two categories.
PathSaveMode
The SaveMode for the Sink connectors that use path to organize data, For example File Connectors.
TableSaveMode
The SaveMode for the Sink connectors that use table or other table structures to organize data.
Add interface for SaveMode
I will add tow interface for SaveMode.
SupportPathSaveMode
The Sink Connectors which support PathSaveMode should implement this interface
SupportTableSaveMode
The Sink Connectors which support TableSaveMode should implement this interface.
Add SaveMode Option to Sink Connector
In order to unify the parameter names of each Sink connector that supports SaveMode, I added two parameters about SaveMode.
Automatically add SaveMode Option to the OptionRule of each connector supported SaveMode
To do this, I add
SupportPathSaveMode
andSupportTableSaveMode
interface check inFactoryUtil.sinkFullOptionRule
.Because
if (sinkClass.isAssignableFrom(SupportPathSaveMode.class))
need to know the Sink Class, So I addClass<? extends SeaTunnelSink> getSinkClass();
toTableSinkFactory
. Every Sink Connector need implementgetSinkClass
method.What stage should SaveMode be processed
I think
void handleSaveMode(PathSaveMode pathSaveMode);
andvoid handleSaveMode(TableSaveMode tableSaveMode);
method should be call afterprepare()
.So I updated the starter code.
org.apache.seatunnel.core.starter.flink.execution.SinkExecuteProcessor#initializePlugins
About automatic create table
I think if we support automatic create table, we can do it after
handleSaveMode
inorg.apache.seatunnel.core.starter.flink.execution.SinkExecuteProcessor#initializePlugins
(or other starter).The text was updated successfully, but these errors were encountered: