Fix: handle tinyint(1) BOOLEAN inference with modifiers like NOT NULL
#72
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