wgzhao commented on PR #12355:
URL: https://github.com/apache/seatunnel/pull/12355#issuecomment-5806847189
No problem at all - head is unchanged at `4f6663a9f`, so there is nothing to
re-sync. Answers to the four points:
**1. The length rule.** `MySqlTypeUtils.java:156-168` (helpers at `:189` and
`:212`). The option values are unquoted first, then: `ENUM` = the longest
single option, `SET` = the sum of the option lengths plus `n-1` separators,
i.e. the length of the value as stored. Concretely `SET('a','b','c')` ->
1+1+1+2 = 5, `SET('only')` -> 4, `ENUM('active','inactive')` -> 8. It measures
the unquoted values, not the raw text: `unquotedValueLength` strips the
surrounding `'` and collapses `''` to `'` before measuring, so
`SET('a,b','it''s')` -> 3 + 4 + 1 = 8.
On multi-byte options, one honest caveat: the measurement is in characters
(`String.length()`), which is the right basis for the reconverted `VARCHAR(n)`
the non-MySQL sinks build, and we deliberately do not apply the
`charTo4ByteLength` conversion VARCHAR uses because that one is about byte
capacity, not the stored string length. `String.length()` counts UTF-16 units,
so an option containing an astral-plane character would count 2 instead of 1 -
that only oversizes the target column, it cannot truncate. If you want it
exact, `codePointCount` plus one assertion is a one-line change; I left it out
because CI has already validated this head, but I will push it if you prefer.
**2. The per-item breakdown** - it is at the conversation level rather than
in the review thread, which is probably why it did not show up for you:
https://github.com/apache/seatunnel/pull/12355#issuecomment-5787984776 (posted
2026-09-23 02:36Z, about ten minutes after your review). Compact mapping: Issue
1 -> `MySqlTypeUtils` length derivation; Issue 2 -> the test Javadoc; Issues 3
and 4 -> the added columns and assertions in that same test; Issue 5 -> the
override's Javadoc.
**3. `columnLength` assertions.** Yes, on the same columns and not only
`getSourceType()`, all through the real pipeline (ANTLR parse -> listener ->
`MySqlTypeUtils` -> `MySqlTypeConverter`), so they pin the length on the
SeaTunnel column: `CustomMySqlAntlrDdlParserTest:137` `SET('a','b','c')` -> 5,
`:143` `ENUM('x','y')` -> 1, `:152` `ENUM('active','inactive')` -> 8, `:159`
`SET('only')` -> 4 (the single-option case), `:167` `SET('a,b','it''s')` -> 8
(embedded comma plus escaped quote), `:175` the `CHARACTER SET utf8mb4` case ->
1.
**4. Javadocs.** The test Javadoc now says the base
`getSourceColumnTypeWithLengthScale` renders the bookkeeping length as `SET(5)`
/ `ENUM(1)` and that the field emitted verbatim into auto-create DDL is
`org.apache.seatunnel.api.table.catalog.Column#getSourceType()`; the override's
Javadoc in `CustomAlterTableParserListener` uses that same fully qualified
reference, so it cannot resolve to the Debezium `Column`.
Locally the module suite is 37/38, with the only failure being
`MySqlSchemaTest` on this machine's JDK 23 (`Mockito`/Byte Buddy), which fails
identically without these changes; on CI this head's `Build` is green after the
Windows flake job was re-run. The branch stays frozen for your review.
--
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]