diff --git a/flow/connectors/mysql/cdc_test.go b/flow/connectors/mysql/cdc_test.go index f38d5e0fc..ff594b215 100644 --- a/flow/connectors/mysql/cdc_test.go +++ b/flow/connectors/mysql/cdc_test.go @@ -644,6 +644,14 @@ func TestShouldReportColumnTypeChange(t *testing.T) { {"maria inet to string", types.QValueKindINET, types.QValueKindString, protos.MySqlFlavor_MYSQL_MARIA, true}, // Bytes on the wire for a non-uuid/inet schema kind is a real change. {"maria string to bytes", types.QValueKindString, types.QValueKindBytes, protos.MySqlFlavor_MYSQL_MARIA, true}, + // Known TABLE_MAP_EVENT limitations. + {"mysql bool as int8", types.QValueKindBoolean, types.QValueKindInt8, protos.MySqlFlavor_MYSQL_MYSQL, false}, + {"maria bool as int8", types.QValueKindBoolean, types.QValueKindInt8, protos.MySqlFlavor_MYSQL_MARIA, false}, + {"mysql enum as string", types.QValueKindEnum, types.QValueKindString, protos.MySqlFlavor_MYSQL_MYSQL, false}, + {"maria enum as string", types.QValueKindEnum, types.QValueKindString, protos.MySqlFlavor_MYSQL_MARIA, false}, + // Other changes from bool or enum must still be reported. + {"bool to int16", types.QValueKindBoolean, types.QValueKindInt16, protos.MySqlFlavor_MYSQL_MYSQL, true}, + {"enum to integer", types.QValueKindEnum, types.QValueKindInt32, protos.MySqlFlavor_MYSQL_MYSQL, true}, // Ordinary type change. {"int to bigint", types.QValueKindInt32, types.QValueKindInt64, protos.MySqlFlavor_MYSQL_MYSQL, true}, } { diff --git a/flow/connectors/mysql/type_conversion.go b/flow/connectors/mysql/type_conversion.go index 3bfc75297..80a48597c 100644 --- a/flow/connectors/mysql/type_conversion.go +++ b/flow/connectors/mysql/type_conversion.go @@ -113,5 +113,13 @@ func shouldReportColumnTypeChange(schemaKind, wireKind types.QValueKind, flavor (schemaKind == types.QValueKindUUID || schemaKind == types.QValueKindINET) { return false } + if schemaKind == types.QValueKindBoolean && wireKind == types.QValueKindInt8 { + // TABLE_MAP omits TINYINT display width, so TINYINT(1) arrives as int8. + return false + } + if schemaKind == types.QValueKindEnum && wireKind == types.QValueKindString { + // TABLE_MAP encodes ENUM as STRING. + return false + } return true }