Hisoka-X commented on code in PR #5663:
URL: https://github.com/apache/seatunnel/pull/5663#discussion_r1366672602
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/common/SeaTunnelAPIErrorCode.java:
##########
@@ -29,6 +29,8 @@ public enum SeaTunnelAPIErrorCode implements
SeaTunnelErrorCode {
DATABASE_ALREADY_EXISTED("API-07", "Database already existed"),
TABLE_ALREADY_EXISTED("API-08", "Table already existed"),
HANDLE_SAVE_MODE_FAILED("API-09", "Handle save mode failed"),
+ SOURCE_ALREADY_HAS_DATA("API-10", "The target data source already has
data"),
+ SINK_TABLE_NOT_EXIST("API-11", "The sink table not exist");
;
Review Comment:
```suggestion
SINK_TABLE_NOT_EXIST("API-11", "The sink table not exist");
```
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DataSaveMode.java:
##########
@@ -21,20 +21,16 @@
* The SaveMode for the Sink connectors that use table or other table
structures to organize data
*/
public enum DataSaveMode {
- // Will drop table in MySQL, Will drop path for File Connector.
- DROP_SCHEMA,
- // Only drop the data in MySQL, Only drop the files in the path for File
Connector.
- KEEP_SCHEMA_DROP_DATA,
+ // Preserve database structure and delete data
+ DROP_DATA,
- // Keep the table and data and continue to write data to the existing
table for MySQL. Keep the
- // path and files in the path, create new files in the path.
- KEEP_SCHEMA_AND_DATA,
+ // Preserve database structure, preserve data
+ AND_DATA,
Review Comment:
What's meaning of `AND_DATA`? I think you mean `APPEND_DATA`?
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DataSaveMode.java:
##########
@@ -21,20 +21,16 @@
* The SaveMode for the Sink connectors that use table or other table
structures to organize data
*/
public enum DataSaveMode {
- // Will drop table in MySQL, Will drop path for File Connector.
- DROP_SCHEMA,
- // Only drop the data in MySQL, Only drop the files in the path for File
Connector.
- KEEP_SCHEMA_DROP_DATA,
+ // Preserve database structure and delete data
+ DROP_DATA,
- // Keep the table and data and continue to write data to the existing
table for MySQL. Keep the
- // path and files in the path, create new files in the path.
- KEEP_SCHEMA_AND_DATA,
+ // Preserve database structure, preserve data
+ AND_DATA,
- // The connector provides custom processing methods, such as running user
provided SQL or shell
- // scripts, etc
+ // User defined processing
CUSTOM_PROCESSING,
- // Throw error when table is exists for MySQL. Throw error when path is
exists.
- ERROR_WHEN_EXISTS
+ // When there is data, an error is reported
Review Comment:
```suggestion
// When there exist data, an error will be reported
```
##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SupportSaveMode.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.api.sink;
+
+/** The Sink Connectors which support schema and data SaveMode should
implement this interface */
+public interface SupportSaveMode {
+
+ String DATA_SAVE_MODE_KEY = "data_save_mode";
+
+ String SCHEMA_SAVE_MODE_KEY = "schema_save_mode";
+
+ // This method defines the return of a specific save_mode handler
+ SaveModeHandler getSaveModeHandler();
Review Comment:
Use optional to avoid NPE
```suggestion
Optional<SaveModeHandler> getSaveModeHandler();
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]