[Feature][MySQL] Regarding the data processing of bit(1), it is hoped that a configuration item will be added to determine whether to convert it to a boolean value or an int.
Search before asking
- [x] I had searched in the feature and found no similar feature requirement.
Description
Currently, in practical scenarios, there are cases where it is necessary to convert bit(1) data in MySQL to int. However, in the latest version 2.3.12, this data type can only be converted to boolean by default, which causes errors when writing data to the target database. Therefore, it is necessary to add a configuration item to determine whether to convert the data to int or boolean.
Now I have modified the source code, and only adjusted it to int to meet my own needs.
Usage Scenario
To address various data processing scenarios
Related issues
No response
Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Please refer https://seatunnel.apache.org/docs/2.3.12/connector-v2/source/Jdbc#int_type_narrowing
Please refer https://seatunnel.apache.org/docs/2.3.12/connector-v2/source/Jdbc#int_type_narrowing
I've tried it. int_type_narrowing only works for tinyint(1), but it still doesn't work for bit(1).
Oh, we should make sure int_type_narrowing works in bit(1) too.
Please assign it to me
The issue remains unresolved in version 2.3.13, and we hope the next version can be updated. Thank you.🙏
Thanks for the follow-up.
I checked the current code path again, including the 2.3.13 tag. The current behavior is:
bit(1)withint_type_narrowing=trueis mapped tobooleanbit(1)withint_type_narrowing=falsefalls back tobyte[]
So from the code perspective, bit(1) is already covered by the current mapping logic, but your main request is still not satisfied: there is still no option to map bit(1) to int.
That means this issue is better treated as an enhancement request, not as a broken int_type_narrowing bug.
I think the safest direction would be:
- keep the current default behavior for compatibility
- add an explicit configuration for
bit(1)target mapping if we want to supportint - avoid silently changing existing jobs that already rely on
boolean
If someone would like to work on this, a focused PR for that additional mapping option would make sense.
This issue has been resolved by the merged PR:
- #9927 [improve] int_type_narrowing parameter is compatible with bit (1) type
Closing as completed. If the problem persists, please reopen with details.