[Feature][Connector-V2] PR1: Pass sink table-options into auto-created MySQL target tables#11120
Open
luxiaolong-ct wants to merge 3 commits into
Open
[Feature][Connector-V2] PR1: Pass sink table-options into auto-created MySQL target tables#11120luxiaolong-ct wants to merge 3 commits into
luxiaolong-ct wants to merge 3 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Open
4 tasks
DanielLeens
approved these changes
Jun 18, 2026
DanielLeens
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this. I reviewed the full diff from JdbcSinkFactory down into the MySQL create-table builder and the new E2E, rather than treating this as a docs-only option addition.
What this PR fixes
- User pain: when JDBC sink auto-creates a MySQL target table, users currently have no real way to pass table-level options such as
engine,charset, orcollatethrough the sink config and get them into the generated DDL. - Fix approach: add shared
table_options, propagate them intoCatalogTable.options, validate them per dialect, and let the MySQL create-table builder append those clauses to the finalCREATE TABLE. - One-line summary: this makes MySQL table-level auto-create options real on the actual DDL path instead of leaving them as unsupported config intent.
Runtime chain I checked
JDBC sink initialization
-> JdbcSinkFactory.createSink(...) [connector-jdbc/.../JdbcSinkFactory.java:71-208]
-> read table_options [73]
-> put table_options into CatalogTable.options [183]
-> load JDBC dialect [187-192]
-> validateTableOptions(...) [193]
Dialect boundary
-> JdbcDialect.validateTableOptions(...) [connector-jdbc/.../JdbcDialect.java:916-925]
-> non-empty table_options fail fast by default
-> MysqlDialect.validateTableOptions(...) [connector-jdbc/.../MysqlDialect.java:402-418]
-> allow only engine / charset / collate
Auto-create path
-> save-mode / catalog createTable(...)
-> MysqlCreateTableSqlBuilder.build(...) [connector-jdbc/.../MysqlCreateTableSqlBuilder.java:138-157]
-> ENGINE = ... [145-147]
-> DEFAULT CHARSET = ... [148-150]
-> COLLATE = ... [151-153]
TiDB compatibility boundary
-> JdbcDialectLoader.load(url, compatibleMode, dialect, fieldIde)
-> MySqlDialectFactory.create(...) [connector-jdbc/.../MySqlDialectFactory.java:44-48]
-> still returns MysqlDialect for MySQL-family compatible modes except StarRocks
Key findings
- The normal MySQL auto-create path really does hit this change.
table_optionsis not only accepted syntactically; it reaches the final DDL builder. - The fail-fast behavior for unsupported dialects is the right safety boundary here. Unsupported JDBC dialects do not silently ignore user intent.
- I did not find a blocking correctness issue in the current head.
- The current docs mention MySQL / TiDB together. From the source path that is reasonable, because the sink still routes MySQL-family compatible modes through
MysqlDialect; the current tests just do not add a TiDB runtime pass yet.
Test / stability note
MysqlDialectTestcovers supported keys, unknown keys, and unsupported-dialect rejection.MysqlCreateTableSqlBuilderTestchecks that the generated DDL really contains the expected clauses.JdbcMysqlTableOptionsITusesSHOW CREATE TABLEplus row-count verification, which is the right signal for this feature and does not rely on weak timing assumptions. I did not see an obvious flaky-test anti-pattern in the new test code.
My merge conclusion for the current head is: can merge.
Blocking items
- None from my side.
Suggested follow-up
- A TiDB runtime coverage pass would still be useful later, since the docs explicitly mention MySQL / TiDB together and the current verification is source-level plus MySQL E2E only.
Overall, the implementation is clean and the scope is well controlled. The option, validation boundary, DDL wiring, E2E, and EN/ZH docs are aligned on the current head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this pull request
Add
table-optionsfor JDBC sink auto-create flow (MySQL first delivery for #11047).table-optionsconfig inSinkConnectorCommonOptionsCatalogTableinJdbcSinkFactoryengine,charset,collateStatus — MySQL JDBC only; StarRocks/Paimon out of scope for this draft.
Does this PR introduce any user-facing change?
Yes. New optional sink config
table-options(map). Applied only whenschema_save_modetriggers DDL (e.g.CREATE_SCHEMA_WHEN_NOT_EXIST). Does not alter existing tables or runtime INSERT/UPSERT.How was this patch tested?
MysqlDialectTest,MysqlCreateTableSqlBuilderTestJdbcMysqlTableOptionsITCheck list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.