SEPURI-SAI-KRISHNA opened a new issue, #13307: URL: https://github.com/apache/seatunnel/issues/13307
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Bug%22) and found no similar issues. ### What happened With `schema-changes.enabled = true`, MySQL-CDC ignores `ALTER TABLE ... RENAME COLUMN old TO new`, although the MySQL-CDC page lists `rename column` as supported. `CustomAlterTableParserListener` handles `CHANGE COLUMN` but has no handler for `RENAME COLUMN`, so the statement gives no schema change event and `SeaTunnelRowDebeziumDeserializeSchema` logs `Unsupported resolve schemaChangeEvent ..., just skip.` Debezium applies the rename to its own table model, so the change records after the DDL carry the new name. The SeaTunnel schema still has the old name, and `SeaTunnelRowDebeziumDeserializationConverters` sets a field that the record does not have to NULL. Every row after the rename therefore has NULL in that column, and the sink keeps the old column name. In `MysqlCDCWithSchemaChangeIT` (Zeta, MySQL 8.0, JDBC sink), after `alter table products rename column add_column to add_column_renamed` on an `INT NOT NULL DEFAULT 1` column, the sink never renames its column, and the next rows fail it with `Column 'add_column' cannot be null`; the job ends `FAILED`. For a nullable column the same code path writes NULL instead of the values without an error. `CHANGE COLUMN add_column add_column_renamed INT NOT NULL DEFAULT 1` works; only the `RENAME COLUMN` form is lost. ### SeaTunnel Version dev (`9fd5128cc1`; the files involved are unchanged on `89f91a89af`) ### SeaTunnel Config ```conf env { parallelism = 1 job.mode = "STREAMING" checkpoint.interval = 5000 } source { MySQL-CDC { url = "jdbc:mysql://mysql:3306/shop" username = "st_user_source" password = "mysqlpw" table-names = ["shop.products"] schema-changes.enabled = true } } sink { jdbc { url = "jdbc:mysql://mysql:3306/shop" driver = "com.mysql.cj.jdbc.Driver" user = "st_user_sink" password = "mysqlpw" generate_sink_sql = true database = shop table = mysql_cdc_e2e_sink_table_with_schema_change primary_keys = ["id"] } } ``` Then, while the job runs, on a table with `add_column INT NOT NULL DEFAULT 1`: ```sql alter table products rename column add_column to add_column_renamed; insert into products values (196,"scooter","Small 2-wheel scooter",3.14,10); ``` ### Running Command ```shell Zeta, MysqlCDCWithSchemaChangeIT#testMysqlCdcWithSchemaEvolutionCase (Testcontainers, MySQL 8.0) ``` ### Error Exception ```log WARN org.apache.seatunnel.connectors.cdc.debezium.row.SeaTunnelRowDebeziumDeserializeSchema - Unsupported resolve schemaChangeEvent SourceRecord{... ddl=alter table products rename column add_column to add_column_renamed ...}, just skip. java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.apache.seatunnel.connectors.seatunnel.jdbc.exception.JdbcConnectorException: ErrorCode:[COMMON-10], ErrorDescription:[Flush data operation that in sink connector failed] - prepare commit failed ... Caused by: java.sql.BatchUpdateException: Column 'add_column' cannot be null ``` ### Zeta or Flink or Spark Version Zeta. The same DDL file also runs in `MysqlCDCWithFlinkSchemaChangeIT` on Flink. ### Java or Scala Version JDK 17 locally. ### Screenshots _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
