Hi everyone, I would like to discuss automatic schema evolution for CDC pipelines that use SQL Transform with the Flink engine.
The intended use cases include: MySQL CDC → SQL Transform → JDBC Sink, for example, writing to TiDB MySQL CDC → SQL Transform → Doris Sink My goal is to support automatic schema evolution through SQL Transform for compatible sinks, including JDBC Sink and Doris Sink. When the source schema changes, Transform should determine how the change affects its output schema and propagate the necessary schema change events downstream. Each sink can then apply the corresponding changes to the target table according to its capabilities and the configured schema evolution behavior. For example, with a wildcard projection, a newly added source column may need to be added to the output schema. With an explicit projection such as id and name, adding an unrelated age column should not change the output schema. If a schema change makes the SQL transformation invalid, the job should fail clearly rather than silently skipping affected records. For the initial discussion, I suggest focusing on MySQL CDC, SQL Transform, the Flink engine, JDBC Sink, and Doris Sink. The supported DDL operations, SQL features, database-specific capabilities, and recovery guarantees for the first version are open for discussion. The design would need to address: 1. Recomputing the output schema when the source schema changes, including projections, aliases, and casts. 2. Preserving the order between records and schema changes, and coordinating parallel sink writers. 3. Applying schema changes safely in JDBC and Doris sinks, taking their different capabilities and database-specific behavior into account. 4. Handling recovery and repeated DDL safely, for example when a DDL succeeds in the sink but the job fails before the next checkpoint completes. 5. Failing clearly when the updated source schema is incompatible with the SQL transformation. The test plan should cover schema changes, SQL transformations, JDBC and Doris sinks, parallel writers, and failures around DDL and checkpoint/savepoint recovery. Related work and references: - Issue: https://github.com/apache/seatunnel/issues/13157 - End-to-end schema evolution: https://github.com/apache/seatunnel/issues/11402 - SQL Transform proposal: https://github.com/apache/seatunnel/pull/12284 - Flink coordination proposal: https://github.com/apache/seatunnel/pull/11912 - Flink CDC Schema Evolution: https://nightlies.apache.org/flink/flink-cdc-docs-release-3.7/docs/core-concept/schema-evolution/ - Flink CDC Transform: https://nightlies.apache.org/flink/flink-cdc-docs-release-3.7/docs/core-concept/transform/ I would appreciate feedback on: 1. Is the proposed initial scope, including both JDBC Sink and Doris Sink, appropriate? 2. How should this work be divided between the existing proposals? 3. What recovery and DDL replay guarantees should the first version provide? 4. Are there sink-specific limitations that should influence the design or initial scope? Thanks!
