wgzhao opened a new pull request, #12372:
URL: https://github.com/apache/seatunnel/pull/12372

   ### Purpose of this pull request
   
   Adds the end-to-end coverage tracked by #12371, the follow-up the reviewer 
asked for on #12355.
   
   When the source dialect matches the sink dialect, the sink builds 
schema-change statements from the
   column's **source type expression** instead of the reconverted type
   (`JdbcDialect#applySchemaChange` for `ADD COLUMN`, `MODIFY COLUMN` and 
`CHANGE COLUMN`). A `SET` /
   `ENUM` column whose expression lost its option list therefore only fails 
once MySQL executes the
   statement - exactly what #12355 fixed on the parsing side. The existing 
cases in
   `MysqlCDCWithSchemaChangeIT` alter `VARCHAR`, `INT`, `FLOAT` and `TIMESTAMP` 
columns only, so nothing
   exercised that path with an option-list type.
   
   ### Dependency on #12355
   
   > **This PR is expected to be red until #12355 merges.** Without the fix the 
sink receives
   > `SET(5)` / `ENUM(3)` instead of `SET('a','b','c')`, MySQL rejects the 
generated `ALTER TABLE`, and
   > the new case fails. That is the regression this test is meant to catch, so 
the red result on `dev`
   > today is the point rather than an accident. I will rebase and mark it 
ready once #12355 lands.
   
   ### What this PR changes
   
   - `mysqlcdc_to_mysql_with_set_enum_schema_change.conf`: a job on 
`shop.products_with_set_enum`
     writing into `mysql_cdc_e2e_sink_table_with_set_enum` with 
`schema-changes.enabled = true`.
   - `ddl/set_enum_schema_change.sql`: fixture for a table that carries `SET` / 
`ENUM` columns before
     the job starts. The `SET` option list includes the literal 
`NO_UNSIGNED_SUBTRACTION`, the shape
     that used to be mis-read as the `UNSIGNED` attribute.
   - `ddl/add_set_enum_columns.sql`: the DDL executed while the job runs - `ADD 
COLUMN` for a `SET` and
     an `ENUM` column, `MODIFY COLUMN` to widen the existing `SET` column, plus 
DML that must keep
     flowing afterwards.
   - `MysqlCDCWithSchemaChangeIT#testMysqlCdcWithSetAndEnumColumnSchemaChange` 
(`@Order(5)`): drives the
     two templates, waits for the CDC reader to reach binlog consumption before 
emitting the DDL, then
     asserts the source and sink converge on both structure and data, and 
compares the
     `information_schema.COLUMNS.COLUMN_TYPE` of the four `SET` / `ENUM` 
columns so a regression reports
     the malformed type directly instead of a `DESCRIBE` diff.
   
   The sink table is pre-created by the fixture, as every other case in this 
suite does: a table created
   by the sink itself is rendered without `AUTO_INCREMENT`, which the shared 
`DESCRIBE` comparison
   would flag for a reason unrelated to this fix. The statement under test is 
the `ALTER TABLE` the sink
   generates, which is what the reconstructed type expression feeds. The 
auto-create `CREATE TABLE` path
   takes its types from the catalog (`information_schema.COLUMN_TYPE`) and is 
not affected by #12355;
   that path is covered on the JDBC side by #12333.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. It only adds e2e coverage; no production code, configuration option, 
default value or public API
   is touched, and no documentation update is required.
   
   ### How was this patch tested?
   
   - `./mvnw -pl 
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e test-compile` 
passes,
     and `spotless:apply` / `spotless:check` are clean on the module.
   - The parsing half of this path is covered by the unit test added in #12355
     (`CustomMySqlAntlrDdlParserTest`, all three DDL forms).
   - **The e2e case itself has not been executed locally**: this environment 
has no container runtime
     (no Docker, podman, colima or lima), and no local MySQL server, so CI is 
its first execution. The
     case deliberately reuses the helpers, fixture mechanism and job-config 
shape that the surrounding
     cases already run with, to keep the untested surface as small as possible.
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [x] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
   * [x] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 and add new connector information in it
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in 
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/seatunnel-connector-v2-e2e)
     5. Update connector 
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   


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