You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "wgzhao (via GitHub)" <gi...@apache.org> on 2026/09/16 01:51:08 UTC
[PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
wgzhao opened a new pull request, #12333:
URL: https://github.com/apache/seatunnel/pull/12333
### Purpose of this pull request
Fixes #10451.
The MySQL catalog and the OceanBase MySQL catalog derived the `UNSIGNED` attribute of a column by
searching the whole `COLUMN_TYPE` string for the word `unsigned`:
```java
boolean unsigned = columnType.toLowerCase(Locale.ROOT).contains("unsigned");
```
`COLUMN_TYPE` is not just the type name. For `SET` and `ENUM` columns it also carries the value
list, and `mysql.event.sql_mode` is declared like this:
```
set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED',...,
'ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE')
```
So the literal value name `NO_UNSIGNED_SUBTRACTION` inside that list was read as the attribute. Both
type converters then append `" UNSIGNED"` to the type name, which turns `SET` into the type
`SET UNSIGNED` - a type that does not exist in MySQL:
```
ErrorCode:[COMMON-17], ErrorDescription:['MySQL' unsupported convert type 'SET UNSIGNED' ...]
```
That happens during catalog discovery, so a multi-table MySQL-CDC job fails at startup before it
reads a single binlog event.
### What this PR changes
In MySQL the `UNSIGNED` attribute is only valid on numeric types, and it is always placed after an
optional length / precision part: `int(10) unsigned`, `bigint(20) unsigned zerofill`, and
`float unsigned` (no length part when declared without precision). So the derivation now reads the
leading type name and checks it against the numeric types that the converters actually describe
with a `*_UNSIGNED` constant:
```java
String dataType = columnType.trim().split("[\\s(]", 2)[0].toUpperCase(Locale.ROOT);
return UNSIGNED_TYPE_NAMES.contains(dataType)
&& columnType.toLowerCase(Locale.ROOT).contains("unsigned");
```
The rule lives in `JdbcCatalogUtils.isNumericUnsignedColumnType(...)` and is now used by both
`MySqlCatalog.buildColumn` and `OceanBaseMySqlCatalog.buildColumn`, which carried the identical bug.
Their converters are symmetric, so the `ENUM('...unsigned...')` sibling case failed in exactly the
same way and is fixed by the same change.
Relationship to #10453: that pull request adds defensive handling for an externally supplied
`SET UNSIGNED` type name. This pull request removes the reason such a name is ever synthesized in
the first place. The two are complementary and neither depends on the other.
### Does this PR introduce _any_ user-facing change?
Yes - it is a bug fix, and it only widens what works:
- **Before**: reading a `SET` or `ENUM` column whose value list contains the word "unsigned"
(through MySQL-CDC startup or through a JDBC catalog read) failed the job with
`COMMON-17 unsupported convert type`.
- **After**: the column is reported as `STRING`, which is the mapping the connector documentation
already describes for `SET` and `ENUM`.
Every genuinely `unsigned` numeric column is unaffected: the attribute can only be attached to the
numeric types in the whitelist, and all of those are still detected, in both the
`int(10) unsigned` and the `float unsigned` shape.
No config option, default value, public API, SPI contract, serialization format or checkpoint state
is touched. `Column#isUnsigned()` is consumed only by the two dialects' type converters, and only
to decide whether to append `" UNSIGNED"`.
### How was this patch tested?
Two focused unit test classes, neither of which needs a MySQL server:
- `JdbcCatalogUtilsTest` covers the derivation itself: unsigned numerics in both shapes
(`int(10) unsigned`, and `float unsigned` which has no length part), signed numerics, the exact
`mysql.event.sql_mode` shape, the `ENUM` sibling shape, and blank input.
- `MySqlCatalogUnsignedDetectionTest` drives the real `MySqlCatalog.buildColumn` with a stubbed
`ResultSet` and asserts the resulting SeaTunnel column type for the same inputs, so the
catalog-side integration is covered too. It needs no server: the catalog constructor probes the
server version, and the test catalog overrides connection acquisition so the probe fails and the
default version is used - which is the production fallback path when the probe cannot reach the
server. `MySqlCatalogTest` is `@Disabled` because it requires a live server, so these offline
cases are kept in a separate class.
I confirmed the regression tests actually catch the bug by reverting only the `MySqlCatalog` line to
the old `contains("unsigned")` derivation and re-running the new class. Both the SET and the ENUM
case fail with the original error and nothing else changed:
```
ErrorCode:[COMMON-17], ErrorDescription:['MySQL' unsupported convert type 'SET UNSIGNED' of 'test' to SeaTunnel data type.]
ErrorCode:[COMMON-17], ErrorDescription:['MySQL' unsupported convert type 'ENUM UNSIGNED' of 'test' to SeaTunnel data type.]
```
Then the full unit test suite of the connector:
```
$ mvn -pl seatunnel-connectors-v2/connector-jdbc test
Tests run: 994, Failures: 0, Errors: 4, Skipped: 6
```
The 4 errors are Testcontainers classes that require Docker (Kingbase and Oracle catalog / dialect
container tests) failing with `Previous attempts to find a Docker environment failed`; they do not
touch the MySQL type conversion path and fail identically without this change.
No E2E case is added. The trigger is a MySQL 5.7 system table shape (`mysql.event` / `mysql.proc`)
that the current MySQL 8 based e2e fixtures do not reproduce, while the derivation and its
conversion consequence are both covered directly by the unit tests above.
### Check list
* [x] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [x] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
* [x] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "wgzhao (via GitHub)" <gi...@apache.org>.
wgzhao commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-5706569315
Thanks for the approval, and for catching both of those - both are fixed in `0dfcce388`.
- **Issue 1**: the case now uses the inherited `connection` field, the same one every other DDL helper in this class uses, instead of opening a second socket to the container mid-class.
- **Issue 2**: the `DROP TABLE` moved into a `finally`, so cleanup no longer depends on all four assertions passing.
## One thing about the CI signal on the previous head
Worth flagging, because it changes how much the red `Build` on `a8a0963d` actually tells us. The run failed in `PostgresCDCIT` (`testPostgresCdcSnapshotOnlyAndCommittedOffsetStartupModes`, ~1395s, `ConditionTimeoutException`) and `OpengaussCDCIT` - the same container flakes you diagnosed - but as a consequence the JDBC lanes never executed at all. `jdbc-connectors-it-part-1` and its siblings (`-part-2` ... `-part-7`, `-ddl`) came back **skipped**, not passed, and `unit-test (11, windows-latest)` failed as well. For reference, the rest of that run was healthy: 40 jobs succeeded, including `mysql-cdc-connector-it`, `unit-test (8, ...)` on both ubuntu and windows, and the code style / license / sanity checks.
So the new `JdbcMysqlIT` case has not actually been exercised in CI yet, which is exactly the confirmation you asked for before merge. This push starts a fresh full run rather than a re-run of the failed jobs, so `jdbc-connectors-it-part-1` should execute this time. I will keep an eye on it and report back here if anything in the JDBC lanes turns red.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "wgzhao (via GitHub)" <gi...@apache.org>.
wgzhao commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-6137068934
Follow-up opened: #12742 — `[Improve][Connector-V2][JDBC] Derive the MySQL UNSIGNED guard from the converter constants`.
It lands all five points: the guard moves into `MySqlTypeConverter` next to the `MYSQL_*_UNSIGNED` constants and derives its base-type set from them (with a test that reflects over the constants, so drift fails CI), it takes `DATA_TYPE` alongside `COLUMN_TYPE`, `OceanBaseMySqlCatalog` calls the same method, the set's javadoc stops claiming it mirrors both converters, and `JdbcOceanBaseMysqlIT` gets the regression case.
One thing worth flagging on point 3: only the ENUM half of the MySQL assertions could be mirrored. `OceanBaseMySqlTypeConverter` has no `MYSQL_SET` case at all, so a SET column fails discovery on OceanBase with or without the guard — the guard is not the deciding factor there. The ENUM shape reproduces the #10451 failure exactly (`ENUM UNSIGNED` before, `ENUM` after), so that is the reachable half; the reasoning is in the PR body.
The follow-up is stacked on this branch's head, so until this PR merges it also carries these commits; once it lands the follow-up diff reduces to its single commit.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "wgzhao (via GitHub)" <gi...@apache.org>.
wgzhao commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-5697389735
Thanks. Follow-up pushed as `a8a0963db`, covering both points.
## Issue 1 - E2E coverage: added
You were right and my justification was wrong. I claimed the trigger needs a MySQL 5.7 system-table shape, but as you point out, an ordinary user-defined `SET` / `ENUM` column whose value list contains the literal word "unsigned" reproduces it on any MySQL version - including the `mysql:8.0.43` image this suite already uses.
`JdbcMysqlIT` now creates a small table alongside the existing fixtures and drives it through real catalog discovery:
```sql
CREATE TABLE `seatunnel`.`set_unsigned_source` (
`c_int` int DEFAULT NULL,
`c_int_unsigned` int unsigned DEFAULT NULL,
`c_set` set('REAL_AS_FLOAT','NO_UNSIGNED_SUBTRACTION') DEFAULT NULL,
`c_enum` enum('unsigned','other') DEFAULT NULL)
```
and asserts the discovered SeaTunnel types: `STRING` for `c_set` and `c_enum`, `LONG` for `c_int_unsigned` (INT UNSIGNED widens), `INT` for `c_int`. The table is dropped again inside the test so it cannot be picked up by the pattern or multi-table cases.
## Issue 2 - javadoc corrected
Fixed. It no longer claims the set mirrors both converters. It now says the set is the one `MySqlTypeConverter` handles and is a *superset* of what `OceanBaseMySqlTypeConverter` handles (`BIT` and `YEAR` have no `*_UNSIGNED` case there), and states why keeping the superset is deliberate: this guard only decides whether a column is unsigned, and narrowing it per dialect would silently drop the attribute for the shared numeric types.
## Independent verification against a real server
This sandbox has no Docker, so I could not run `JdbcMysqlIT` itself. I validated both its assumptions and the fix separately, against a throwaway MySQL instance (`mysqld --initialize-insecure` in a temp dir, MySQL 9.7.2) using the real Connector/J driver and the real `MySqlCatalog`:
With the fix applied:
```
c_int -> INT sourceType=int
c_int_unsigned -> BIGINT sourceType=int unsigned
c_float_unsigned -> FLOAT sourceType=float unsigned
c_bigint_unsigned -> Decimal(20, 0) sourceType=bigint unsigned
c_set -> STRING sourceType=set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE')
c_enum -> STRING sourceType=enum('unsigned','signed','other')
c_set_plain -> STRING sourceType=set('a','b')
```
With only the `MySqlCatalog` line reverted to the old derivation, same server, same driver:
```
ErrorCode:[COMMON-20], 'mysql' table 'seatunnel.set_unsigned_source' unsupported get catalog table
with field data types '{"c_set":"SET UNSIGNED","c_enum":"ENUM UNSIGNED"}'
```
Two facts fell out of that run which are worth recording, because both would be easy to get wrong:
1. MySQL 8/9 no longer reports the display width for integer types. `int(10) unsigned` comes back as `int unsigned` and `bigint(20) unsigned` as `bigint unsigned`. A derivation keyed off the `(` would have silently missed these; the leading-token form handles both shapes.
2. `DATA_TYPE` comes back lowercase (`set`, `enum`, `int`). That is why simply dropping the substring check is not enough on its own - the leading token has to be uppercased for the whitelist lookup.
Thanks for the CI triage on the Postgres / openGauss / Pulsar lanes; that matches what I see, and the `connector-jdbc` module reports SUCCESS in the same reactor run.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "wgzhao (via GitHub)" <gi...@apache.org>.
wgzhao commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-6119572125
Thanks @SEZ9 — I went through all five points against the current head and I agree with every one of them. None of them changes behaviour, so my plan is to land them together as one small follow-up change rather than push another commit here.
Per item:
**1 — whitelist drift.** Agreed, this is the one that actually matters. The set is a literal copy of the `MYSQL_*_UNSIGNED` constants in `MySqlTypeConverter` with only a Javadoc sentence tying them together, so adding a type on one side can silently drop the `unsigned` widening — or recreate the `COMMON-17` failure this PR fixes. I'll derive the set from the converter constants (strip the `" UNSIGNED"` suffix) and keep a unit test asserting every constant's base name is accepted, so drift fails CI either way.
**2 — use `DATA_TYPE`.** Agreed. Both `buildColumn` implementations already read the server-normalised `DATA_TYPE`, so re-tokenising `COLUMN_TYPE` is a second, independently parsed notion of the type name. I'll change the helper to `isNumericUnsignedColumnType(String dataType, String columnType)` and keep the single-argument form only if the pure-string unit tests are clearer with it.
**3 — OceanBase IT.** Agreed, and this one is on me: the PR changes `OceanBaseMySqlCatalog.buildColumn` but only `JdbcMysqlIT` got the regression case, which breaks our "update the existing IT for the connector you changed" rule. I'll mirror the four assertions into `JdbcOceanBaseMysqlIT`, since `OceanBaseMySqlTypeConverter` is a different class (it has no `BIT`/`YEAR` unsigned cases) and that is the only place its interaction with the new guard meets a real server.
**4 — Javadoc wording.** Agreed. `BIT` and `YEAR` do not accept `UNSIGNED` in MySQL; they are in the set only for parity with `MYSQL_BIT_UNSIGNED` / `MYSQL_YEAR_UNSIGNED`. I'll reword the first sentence so nobody later "corrects" the list from the MySQL rule — membership itself stays as is, for the reason given in the second sentence.
**5 — placement.** Agreed, and it bundles nicely with (1): moving the helper into `internal/dialect/mysql` puts it next to the constants it has to stay in step with, and `OceanBaseMySqlCatalog` can call the same method.
Why not in this PR: the head is green and already carries an approving review, and a new commit would dismiss that review and re-run the full Build, while all five points are Low and behaviour-neutral. If you would rather see them here instead, say so and I'll push them onto this branch instead of opening a follow-up — happy either way.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-6136900953
@wgzhao thanks for going through all five — a separate follow-up is fine with me. They're all Low and behaviour-neutral, so there's no need to churn this branch; I'm happy for this PR to go in as-is with the cleanup landing in one small follow-up as you propose.
On the plan itself:
1. **Whitelist drift** — deriving the set from the `MYSQL_*_UNSIGNED` constants in `MySqlTypeConverter` plus a unit test asserting every constant's base name is accepted is exactly what I had in mind. Please keep that test; it's what makes drift fail loudly.
2. **`DATA_TYPE`** — `isNumericUnsignedColumnType(String dataType, String columnType)` sounds right, with the catalogs all going through that one entry point.
3. **OceanBase IT** — mirroring the assertions into `JdbcOceanBaseMysqlIT` covers it.
4. **Javadoc** — agreed, reword only; membership stays for parity with `MYSQL_BIT_UNSIGNED` / `MYSQL_YEAR_UNSIGNED`.
5. **Placement** — moving the helper next to the constants and having `OceanBaseMySqlCatalog` call the same method bundles naturally with (1).
When you open the follow-up, please link it back here so the trail is easy to find. Nothing else outstanding from my side on this PR.
<!-- streview-comment:1706 -->
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "wgzhao (via GitHub)" <gi...@apache.org>.
wgzhao commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-6072128910
Gentle bump — this one is code-complete and has cleared source review (@DanielLeens), but it's still gated by the `dev` ruleset requiring an approving review from an account with **write access** (contributor approvals don't count toward it).
Heads-up on CI so it isn't misread: `Build` is currently red on head `4c8b583a`, and the failing lanes — `unit-test (8, windows-latest)`, `iceberg-connector-it`, `doris-connector-it`, `updated-modules-integration-test-part-8` — don't touch the JDBC catalog path this changes, so they look like the usual flakes rather than a regression here. A re-run (plus a committer approval) should clear it. @SEZ9 @davidzollo @nzw921rx
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2][JDBC] Derive the MySQL UNSIGNED attribute only for numeric columns [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12333:
URL: https://github.com/apache/seatunnel/pull/12333#issuecomment-6109460143
Hi @wgzhao, a quick follow-up on the CI note in my last review (head `eaa91181c`, which has not changed). One part of that advice is now outdated, so I want to correct it before you spend more reruns.
**What I said:** the only red jobs were `elasticsearch-connector-it (11)` and `(17)`, unrelated to this PR, and the cheapest step was to rerun just those two jobs.
**What I see now:**
- Your fork run (`Build`, run attempt 4) is still failing in exactly the same two jobs, and the same cases: `ElasticsearchIT#testElasticsearchWithScrollSlice` and `testElasticsearchWithPITSliceQueued` (e.g. `iterable lengths differ, expected: <11> but was: <0>`). Attempts 1 to 3 failed in the same two jobs, so another plain rerun of this head is unlikely to turn green.
- This PR touches only the JDBC MySQL/OceanBase catalog code and `JdbcMysqlIT`; nothing on the Elasticsearch path, so I still read this as unrelated to the diff.
- The test-side fix for these exact cases has just landed on `dev`: #12711 `[Test][Connector-V2][Elasticsearch] Poll for index visibility in ElasticsearchIT slice tests` (merged 2026-10-11, after my last review). It makes the slice tests poll for index visibility, like #12642 did for the other reads, and your head does not contain it yet (the branch is currently 10 ahead / 6 behind that commit).
**Suggested next step:** please sync the latest `dev` into your branch, then rerun only the failed jobs (or let the new run go through). Earlier I said that syncing would not help; with #12711 on `dev` it now should.
My source-side conclusion is unchanged: no code blockers on this PR. The remaining gates are a green CI run on the synced head and the final committer approval (`reviewDecision` is still `REVIEW_REQUIRED`). Thanks for your patience!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org