[Feature][Connector-V2] Jdbc mysql support read tinyint(1) to byte(tinyint)#9373
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an int_type_narrowing option to let SeaTunnel read MySQL TINYINT(1) as a byte instead of a boolean when set to false.
- Introduce and wire
int_type_narrowingthroughJdbcOptions,JdbcConnectionConfig, source factory, catalog utils, converters, mappers, and catalog implementations - Update integration tests, SQL/CONN fixture files, and unit tests to cover both boolean and byte mapping
- Enhance documentation (EN/ZH) to describe the new option
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| connector-jdbc/src/main/java/.../JdbcOptions.java | Add INT_TYPE_NARROWING option key and description |
| connector-jdbc/src/main/java/.../JdbcConnectionConfig.java | New intTypeNarrowing field, builder, and config mapping |
| connector-jdbc/src/main/java/.../MySqlTypeConverter.java | Adjust constructor overloads and branch on intTypeNarrowing |
| connector-jdbc/src/main/java/.../MySqlCatalog.java & AbstractJdbcCatalog.java | Pass tinyInt1isBit=false when narrowing disabled |
| connector-jdbc/src/main/java/.../JdbcSourceFactory.java | Include INT_TYPE_NARROWING in optionRule() |
| connector-jdbc/.../MySqlTypeMapperTest.java & JdbcMysqlMultipleTablesIT.java | Add unit and integration tests for both mapping modes |
| seatunnel-e2e/.../*.conf & .sql | Update queries and table definitions to use new c_tinyint_1 column |
| docs/zh/connector-v2/source/Mysql.md & docs/en/.../Mysql.md, Jdbc.md | Document int_type_narrowing and its effects |
Comments suppressed due to low confidence (1)
docs/en/connector-v2/source/Mysql.md:94
- [nitpick] You have duplicated
int_type_narrowingdocs here and in Jdbc.md; consider moving shared option descriptions into a common section to reduce duplication and maintain consistency.
| int_type_narrowing | Boolean | No | true | Int type narrowing, if true, the tinyint(1) type will be narrowed to the boolean type if without loss of precision. Support for MySQL at now. |
| .withDescription( | ||
| "decimal type narrowing, if true, the decimal type will be narrowed to the int or long type if without loss of precision. Only support for Oracle at now."); | ||
|
|
||
| Option<Boolean> INT_TYPE_NARROWING = |
There was a problem hiding this comment.
[nitpick] Consider rephrasing the description to "Currently supported for MySQL only." to improve clarity and correct grammar.
| private final MySqlVersion version; | ||
| private final boolean intTypeNarrowing; | ||
|
|
||
| public MySqlTypeConverter() { |
There was a problem hiding this comment.
[nitpick] The constructors for MySqlTypeConverter (no-arg, single-arg, two-arg) are interleaved; grouping and ordering them together can improve readability.
3 tasks
corgy-w
approved these changes
Jun 5, 2025
hailin0
approved these changes
Jun 6, 2025
dybyte
pushed a commit
to dybyte/seatunnel
that referenced
this pull request
Jul 23, 2025
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
Before this pr, when SeaTunnel read tinyint(1) from MySQL. It will be convert to boolean type.
This pr introduce new option named
int_type_narrowing. By setint_type_narrowingtofalse, let SeaTunnel read tinyint(1) as SeaTunnel Byte type (same as tinyint).Does this PR introduce any user-facing change?
no
How was this patch tested?
add new test.
Check list
New License Guide