hailin0 commented on code in PR #5535:
URL: https://github.com/apache/seatunnel/pull/5535#discussion_r1363297739


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java:
##########
@@ -188,53 +192,46 @@ public Optional<Serializer<XidInfo>> 
getCommitInfoSerializer() {
     }
 
     @Override
-    public DataSaveMode getUserConfigSaveMode() {
-        return dataSaveMode;
-    }
-
-    @Override
-    public void handleSaveMode(DataSaveMode saveMode) {
-        if (catalogTable != null) {
-            Map<String, String> catalogOptions = 
config.get(CatalogOptions.CATALOG_OPTIONS);
-            if (catalogOptions != null) {
-                String factoryId = 
catalogOptions.get(CommonOptions.FACTORY_ID.key());
-                if (StringUtils.isBlank(jdbcSinkConfig.getDatabase())) {
-                    return;
-                }
-                CatalogFactory catalogFactory =
-                        discoverFactory(
-                                Thread.currentThread().getContextClassLoader(),
-                                CatalogFactory.class,
-                                factoryId);
-                if (catalogFactory != null) {
-                    try (Catalog catalog =
-                            catalogFactory.createCatalog(
-                                    catalogFactory.factoryIdentifier(),
-                                    ReadonlyConfig.fromMap(new 
HashMap<>(catalogOptions)))) {
-                        catalog.open();
-                        FieldIdeEnum fieldIdeEnumEnum = 
config.get(JdbcOptions.FIELD_IDE);
-                        String fieldIde =
-                                fieldIdeEnumEnum == null
-                                        ? FieldIdeEnum.ORIGINAL.getValue()
-                                        : fieldIdeEnumEnum.getValue();
-                        TablePath tablePath =
-                                TablePath.of(
-                                        jdbcSinkConfig.getDatabase()
-                                                + "."
-                                                + 
CatalogUtils.quoteTableIdentifier(
-                                                        
jdbcSinkConfig.getTable(), fieldIde));
-                        if 
(!catalog.databaseExists(jdbcSinkConfig.getDatabase())) {
-                            catalog.createDatabase(tablePath, true);
-                        }
-                        catalogTable.getOptions().put("fieldIde", fieldIde);
-                        if (!catalog.tableExists(tablePath)) {
-                            catalog.createTable(tablePath, catalogTable, true);
-                        }
-                    } catch (Exception e) {
-                        throw new 
JdbcConnectorException(HANDLE_SAVE_MODE_FAILED, e);
-                    }
-                }
-            }
+    public DefaultSaveModeHandler getSaveModeHandler() {
+        if (catalogTable == null) {
+            return null;
+        }
+        Map<String, String> catalogOptions = 
config.get(CatalogOptions.CATALOG_OPTIONS);

Review Comment:
   waiting for this pr merge
   
   
https://github.com/apache/seatunnel/pull/5645/files#diff-7f5a666dea16fd335df8fa77f399a3386792eea3e5d094b39e2a30636e526d13L197



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

Reply via email to