CodeWithPravinMaske commented on PR #12608:
URL: https://github.com/apache/seatunnel/pull/12608#issuecomment-6208998782
@DanielLeens @SEZ9 thanks, and sorry: the trim commit hadn't reached GitHub.
It's pushed now as `1d629b844` (only the `@DisabledOnContainer` of
`testMysqlCdcNullInNullableUniqueKeyWithoutPrimaryKey` changes, adding
`EngineType.FLINK`).
@SEZ9, on your two questions:
- **F3/F6 (MySQL-CDC docs).** One correction to the premise: with the parser
fix, a nullable column listed in `table-names-config.primaryKeys` **no longer**
coerces NULL to the type default. It emits NULL like any promoted unique-key
column, because `CatalogTableUtils#mergeCatalogTableConfig(Table,
CatalogTable)` only overrides the key names and never touches nullability. The
"Read tables without a primary key" section of
`docs/{en,zh}/connectors/source/MySQL-CDC.md` says exactly that: NULL in a
nullable unique key column, or in a nullable column configured in
`table-names-config.primaryKeys`, is emitted as NULL in the snapshot and binlog
phases. It also recommends a NOT NULL key when UPDATE/DELETE must be applied by
key, and notes the `exactly_once = true` caveat. Since #12597, the same section
also says a configured `primaryKeys` column must be NOT NULL to be used for
splitting the snapshot.
- **F4 (`MySqlSchemaTest#testNullableColumnConfiguredAsPrimaryKeyEmitsNull`,
from fa70f3eb8).**
- It builds the catalog table through the real `table-names-config` path:
`CatalogTableUtils.mergeCatalogTableConfig(catalogTable, config)` with
`primaryKeys = ["code"]`, which marks the catalog column NOT NULL.
- It then parses `CREATE TABLE no_pk (id int NOT NULL, code int DEFAULT
NULL, UNIQUE KEY uk_code (code))` through `MySqlSchema`.
- It asserts that the Debezium primary key is `[code]` and that `code`
stays optional.
- Finally it converts a row with `code = NULL` through the Debezium table
schema (`valueFromColumnData(new Object[] {2, null})`) and asserts that the
value is NULL, not `0`.
- With Debezium's original parser behaviour, this test fails, as do the
other nullability tests.
--
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]