Hi Hainan, This is a valuable use case, especially for CDC pipelines that need both data masking and schema evolution. I support including it in the end-to-end contract discussion in #11402 <https://github.com/apache/seatunnel/issues/11402>, and suggest clarifying the following boundaries first.
1. Initial scope and SQL semantics Both JDBC and Doris can be included in the design, but each should have its own support matrix and acceptance criteria. The first implementation could use MySQL CDC, explicitly identified Flink versions, a limited set of SQL expressions, and one specific JDBC target as the baseline, then validate the differences for TiDB and Doris separately. Whether both sinks are delivered together should depend on the completeness of their DDL, parallel-writing, and recovery tests. On the SQL side, I suggest covering SELECT *, explicit projections, aliases, casts, and the actual masking expressions. Adding a column that is not projected should not change the target schema. If a referenced column is dropped, renamed, or changed to an incompatible type, the failure behavior needs to be explicit. For functions and UDFs, we should also distinguish which type incompatibilities can be detected when the schema event arrives and which may only surface when processing a data row. 2. Alignment with existing work #12284 <https://github.com/apache/seatunnel/pull/12284> can provide the foundation for deriving the SQL output schema and translating schema change events, while Flink event delivery and recovery still need independent validation. For coordination, we should evaluate #11912 <https://github.com/apache/seatunnel/pull/11912> together with #11958 <https://github.com/apache/seatunnel/issues/11958>/#11960 <https://github.com/apache/seatunnel/pull/11960>. They overlap architecturally in Flink schema coordination. I suggest agreeing on the consistency model and the responsibilities for ownership, writer refresh, and checkpoint state before splitting the implementation into PRs. #11960 <https://github.com/apache/seatunnel/pull/11960> already includes some Transform event-bridging logic that is worth evaluating for reuse. 3. Minimum ordering and recovery contract Old-schema records for a table should complete the necessary flush or commit before DDL is applied. Records that depend on the new schema must not be processed before all relevant writers have refreshed their runtime state. If a checkpoint is used as the confirmation boundary, we need to demonstrate that it actually covers the schema control message and writer refresh. A larger checkpoint ID alone is not sufficient evidence. External DDL usually cannot be committed atomically with a Flink checkpoint. A safer contract is therefore replayable, convergent execution: if DDL succeeds but the checkpoint has not completed, recovery should safely reconcile the target schema or fail explicitly, rather than directly promise exactly-once DDL. Checking only whether a column name exists is also insufficient for type changes, renaming followed by name reuse, or drop-and-readd operations. 4. End-to-end acceptance JDBC and Doris should be validated separately. I suggest covering multiple TaskManagers, parallel writers, concurrent checkpoints, delayed control messages, and failures at different points before and after DDL application. After recovery, tests should verify the actual columns, types, and values of the first record. They should also cover schema changes absorbed by the SQL projection, consecutive DDL, savepoints, and rescaling. A short STIP would be a useful next step, documenting the support matrix, state transitions, recovery semantics, and test matrix, and linking #11402 <https://github.com/apache/seatunnel/issues/11402>, #12284 <https://github.com/apache/seatunnel/pull/12284>, #11912 <https://github.com/apache/seatunnel/pull/11912>, #11960 <https://github.com/apache/seatunnel/pull/11960>, and #12983 <https://github.com/apache/seatunnel/issues/12983>. This would let us build on the contributors' existing work while validating Flink CDC -> SQL -> Sink as a complete pipeline. For real-time follow-up discussions, I suggest using the #contributors channel in the SeaTunnel Slack workspace: https://s.apache.org/seatunnel-slack Keeping those discussions in a shared community channel gives contributors a fair and open opportunity to follow the conversation and participate. Key design decisions and conclusions should still be summarized back on this dev mailing-list thread, so they remain publicly archived and available for asynchronous review. Best regards, David On Sun, 08 Nov 2026 18:45:47 +0800, Hainan Wu <[email protected]> wrote: 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!
