Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Relaxed Conversion Logic for Codecs #285

Open
jchrys opened this issue Jul 29, 2024 · 1 comment
Open

Implement Relaxed Conversion Logic for Codecs #285

jchrys opened this issue Jul 29, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@jchrys
Copy link
Collaborator

jchrys commented Jul 29, 2024

Existing codec implementation exhibits strict type conversions. For instance, boolean codec converts to boolean only when data type is binary or TINYINT(1) BIT(1). However, In many real-world applications, data stored in MySQL databases can be represented in multiple formats. Specifically, Boolean values might be stored in columns with different data types such as VARCHAR or CHAR, where values like 'true', 'false', '1', '0' are used to represent Boolean states. The current implementation does not support converting these string representations to Boolean values, causing inconvenience and additional data transformation efforts.

@jchrys jchrys added the enhancement New feature or request label Jul 29, 2024
@jchrys jchrys added this to the Next milestone Jul 29, 2024
@jchrys
Copy link
Collaborator Author

jchrys commented Aug 5, 2024

jchrys pushed a commit that referenced this issue Nov 29, 2024
@jchrys #285 

Motivation:
To allow boolean values stored as strings in MySQL database such as
"true", "false", "1" and "0" to be converted to their corresponding
boolean values.

Modification:
BooleanCodec: Changed decode method to check if VARCHAR value is a
boolean value. Changed doCanDecode to add VARCHAR.
BooleanCodecTest: Added decodeString test to ensure boolean values
stored as strings are converted into the correct corresponding boolean
values.

Result:
Boolean values stored as strings can now be converted to their
corresponding boolean values. Drawbacks are that there could be a string
column containing numeric data with values other than 0 or 1 and the
column isn't used for storing boolean values at the same time the codec
interprets the 0's and 1's as boolean. Only boolean values "true",
"false", "1" and "0" are decoded, other possible types of boolean value
strings haven't been included. Also, doCanDecode states that the VARCHAR
data type can be decoded but only a small subset of this data type can
be decoded and it's not possible to highlight the conditions in the
doCanDecode method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant