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

   ### 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
   
   > **While #12355 is unmerged this PR is expected to be red.** 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 
a red run on `dev`
   > today is the point rather than an accident. I will rebase this onto `dev` 
once #12355 lands; the
   > case should then pass without further changes.
   >
   > The parsing half of the path is already covered by the unit test in #12355
   > (`CustomMySqlAntlrDdlParserTest`, all three DDL forms), and the run on 
this PR is what validates
   > the end-to-end half.
   
   ### 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 e2e case itself is verified through the GitHub Actions run on this PR, 
which is its first
     execution: the machine used to prepare the patch has no container runtime 
(no Docker, podman,
     colima or lima) and no local MySQL server. The case deliberately reuses 
the helpers, fixture
     mechanism and job-config shape the surrounding cases already run with, to 
keep the unverified
     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