Fix: handle tinyint(1) BOOLEAN inference with modifiers like NOT NULL#72
Open
WittgensteinBeetle wants to merge 1 commit intomainfrom
Open
Fix: handle tinyint(1) BOOLEAN inference with modifiers like NOT NULL#72WittgensteinBeetle wants to merge 1 commit intomainfrom
tinyint(1) BOOLEAN inference with modifiers like NOT NULL#72WittgensteinBeetle wants to merge 1 commit intomainfrom
Conversation
…to not read additional schema data
maxenglander
reviewed
Nov 5, 2025
Collaborator
maxenglander
left a comment
There was a problem hiding this comment.
this looks good, will approve this once tests pass and my comments are addressed
| } | ||
| } | ||
|
|
||
| //Adding an additional unit test for the tinyint(1) as bool handling since the orginals were not wide enough |
Collaborator
There was a problem hiding this comment.
can remove this comment and the next line
| treatTinyIntAsBoolean bool | ||
| expected fivetransdk.DataType | ||
| }{ | ||
| {"tinyint(1)", true, fivetransdk.DataType_BOOLEAN}, |
Collaborator
There was a problem hiding this comment.
is there any reason these test cases can't fit as cases into the existing TestSchema_CanPickRightFivetranType test rather than defining a new test?
|
|
||
| //empty schema condition | ||
| if len(parts) == 0 { | ||
| return fivetransdk.DataType_UNSPECIFIED, nil |
Collaborator
There was a problem hiding this comment.
nice, can we add a test case for this?
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.
Problem
The
getFivetranDataTypefunction originally only returnedBOOLEANif the MySQL type was exactly"tinyint(1)". This excluded common real-world variants like:tinyint(1) NOT NULLtinyint(1) unsignedtinyint(1) zerofillTINYINT(1)(case insensitivity)These types should be safely treated as booleans when
treatTinyIntAsBooleanis enabled — which matches MySQL connector behavior and expectations from most CDC systems.Fix
The logic has been updated to:
mysqlTypeto lowercasestrings.Fields)"tinyint(1)") for the boolean matchThis avoids false negatives while ensuring that
tinyint(2+)are not misclassified as booleans.Test Coverage
Added unit tests for:
tinyint(1)-- Passtinyint(1) NOT NULL-- Passtinyint(1) unsigned-- Passtinyint(2)-- Failtinyint-- FailTINYINT(1)-- PassAdded an additional unit test to include these parameters as the original did not include these edge cases