hutiefang76 opened a new issue, #12515: URL: https://github.com/apache/seatunnel/issues/12515
### Search before asking I searched the open issues and PRs for DuckDB save modes and found no matching implementation. ### What happened The DuckDB JDBC sink advertises `schema_save_mode` and `data_save_mode`, but three existing modes fail before writing because DuckDBCatalog inherits unimplemented SQL hooks from AbstractJdbcCatalog: - `RECREATE_SCHEMA` fails when dropping an existing target table. - `DROP_DATA` fails when truncating an existing target table. - `ERROR_WHEN_DATA_EXISTS` fails even for an empty existing target. The default append path succeeds in the same fixture. This is a missing SeaTunnel Catalog implementation, rather than DuckDB rejecting these SQL operations. ### SeaTunnel version Current dev at `b2045b14c`; DuckDB JDBC `1.3.1.0`, JDK 17. I have not established an affected released version or a backport target. ### Reproduction Create a DuckDB file with `main.save_mode_target(id INTEGER)` and one existing row. Use a one-column INT input and the real JdbcSinkFactory, configured with: ```hocon url = "jdbc:duckdb:/tmp/save-mode.db" driver = "org.duckdb.DuckDBDriver" database = "default" table = "main.save_mode_target" schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST" data_save_mode = "DROP_DATA" ``` Call the sink's SaveModeHandler.open/handleSaveMode. Repeat with `RECREATE_SCHEMA` + `APPEND_DATA`; for `ERROR_WHEN_DATA_EXISTS`, start with an empty table. These are actual factory/save-mode regressions, not an assertion on generated SQL alone. ### Error The underlying failure is `UnsupportedOperationException` from AbstractJdbcCatalog.getDropTableSql/getTruncateTableSql/getExistDataSql; the truncate path wraps it in CatalogException. The original five-test Source/Sink fixture reports three errors, while append and the existing flow pass. ### Expected behavior Recreate should replace the existing table with the input schema; drop-data should clear rows and retain the schema; the data-existence mode should accept an empty target and reject a populated target without modifying its rows. Explicit attached catalog names must be retained so these operations cannot clear or drop a same-named local table. I have a focused fix and real JDBC regressions ready. Attached-catalog metadata/CREATE TABLE routing remains separately tracked in #12506. -- 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]
