wgzhao opened a new issue, #12371:
URL: https://github.com/apache/seatunnel/issues/12371

   ### Context
   
   #12355 rebuilt the source type of `SET` / `ENUM` columns on the DDL-event 
path so the option list
   survives (`SET('a','b','c')` instead of `SET(5)`). Its regression test is a 
unit test
   (`CustomMySqlAntlrDdlParserTest`, `connector-cdc-mysql`), which proves the 
type string is
   reconstructed correctly for `ADD COLUMN`, `MODIFY COLUMN` and `CHANGE 
COLUMN`. It does not prove that
   MySQL accepts the DDL the sink generates from that string. This issue tracks 
that missing end-to-end
   coverage.
   
   ### What is already covered, and what is not
   
   Covered: the string produced by 
`CustomAlterTableParserListener#getSourceColumnTypeWithLengthScale`
   
(`seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/parser/CustomAlterTableParserListener.java`),
   which renders `typeName(v1,v2,...)` from `Column#enumValues()`.
   
   Not covered: that the generated statement is valid MySQL. The value flows 
unchanged into the
   generated DDL - `MysqlCreateTableSqlBuilder` uses `Column#getSourceType()` 
verbatim for MySQL
   
(`seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/mysql/MysqlCreateTableSqlBuilder.java:195-197`)
   - so a malformed type string only fails at the sink, against a real server. 
That is exactly how the
   original defect surfaced: `COMMON-17 unsupported convert type` for the `SET 
UNSIGNED` form, and a
   MySQL syntax error for the `SET(5)` form.
   
   ### Suggested coverage
   
   Host it in `MysqlCDCWithSchemaChangeIT`
   
(`seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/MysqlCDCWithSchemaChangeIT.java`)
   with `mysqlcdc_to_mysql_with_schema_change.conf`, which already runs a zeta 
job against a MySQL sink
   with schema evolution:
   
   1. Start the job on `shop.products`.
   2. Run `ALTER TABLE products ADD COLUMN c_set SET('a','b','c') NULL` (plus 
an `ENUM` variant).
   3. Assert the job survives the DDL and the sink table gains the column, 
comparing source and sink
      `information_schema.COLUMNS.COLUMN_TYPE` the way the existing cases do.
   4. Optionally repeat through `MODIFY` / `CHANGE COLUMN`, so all three DDL 
forms are exercised
      against a real server rather than only in the parser unit test.
   
   ### Points to settle while implementing
   
   - `mysqlcdc_to_mysql_with_schema_change.conf` does not set 
`schema_save_mode` explicitly. Confirm
     which mode is in effect and whether the auto-create branch is the one 
exercised; the user-visible
     failure was in the generated `CREATE TABLE`, so a case that goes through
     `CREATE_SCHEMA_WHEN_NOT_EXIST` is the one that matters.
   - Decide whether to assert on the sink column type only, or also assert that 
no unsupported-type
     error is raised along the way.
   
   ### Scope notes
   
   - The initial snapshot path is not affected: table structures discovered at 
job start come from the
     JDBC catalog and carry the full `information_schema.COLUMN_TYPE` literal.
   - Only columns added or modified while the job is running go through the 
code path this issue
     targets.
   
   ### Related
   
   - #12355 - the fix this coverage belongs to
   - #12354 - the parsing-side defect fixed in #12355
   


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