seatunnel icon indicating copy to clipboard operation
seatunnel copied to clipboard

[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.

Open JanSay opened this issue 1 year ago • 7 comments

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. Image

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

JanSay avatar Sep 18 '25 09:09 JanSay

Please refer https://seatunnel.apache.org/docs/2.3.12/connector-v2/source/Jdbc#int_type_narrowing

Hisoka-X avatar Sep 20 '25 13:09 Hisoka-X

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).

JanSay avatar Sep 21 '25 00:09 JanSay

Oh, we should make sure int_type_narrowing works in bit(1) too.

Hisoka-X avatar Sep 21 '25 02:09 Hisoka-X

Please assign it to me

misi1987107 avatar Oct 09 '25 06:10 misi1987107

The issue remains unresolved in version 2.3.13, and we hope the next version can be updated. Thank you.🙏

JanSay avatar Apr 02 '26 02:04 JanSay

Thanks for the follow-up.

I checked the current code path again, including the 2.3.13 tag. The current behavior is:

  • bit(1) with int_type_narrowing=true is mapped to boolean
  • bit(1) with int_type_narrowing=false falls back to byte[]

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:

  1. keep the current default behavior for compatibility
  2. add an explicit configuration for bit(1) target mapping if we want to support int
  3. 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.

DanielLeens avatar Apr 07 '26 13:04 DanielLeens

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.

zhangshenghang avatar Aug 12 '26 14:08 zhangshenghang