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

source-mysql: fix regression involving boolean values in CDC #51519

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data:
connectorSubtype: database
connectorType: source
definitionId: 435bb9a5-7887-4809-aa58-28c27df0d7ad
dockerImageTag: 3.11.1
dockerImageTag: 3.11.2
dockerRepository: airbyte/source-mysql
documentationUrl: https://docs.airbyte.com/integrations/sources/mysql
githubIssueLabel: source-mysql
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import io.airbyte.cdk.read.cdc.ResetDebeziumWarmStartState
import io.airbyte.cdk.read.cdc.ValidDebeziumWarmStartState
import io.airbyte.cdk.ssh.TunnelSession
import io.airbyte.cdk.util.Jsons
import io.debezium.connector.binlog.converters.TinyIntOneToBooleanConverter
import io.debezium.connector.mysql.MySqlConnector
import io.debezium.connector.mysql.gtid.MySqlGtidSet
import io.debezium.document.DocumentReader
Expand Down Expand Up @@ -420,10 +421,9 @@ class MySqlSourceDebeziumOperations(
.withDatabase("include.list", databaseName)
.withOffset()
.withSchemaHistory()
.withConverters(
MySqlSourceCdcBooleanConverter::class,
MySqlSourceCdcTemporalConverter::class
)
.with("converters", "tinyint-one,temporal")
.with("tinyint-one.type", TinyIntOneToBooleanConverter::class.qualifiedName!!)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set a custom converter when it's debezium's own?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still have to opt in to it, it's not Debezium's default behaviour.

.with("temporal.type", MySqlSourceCdcTemporalConverter::class.qualifiedName!!)

cdcIncrementalConfiguration.serverTimezone
?.takeUnless { it.isBlank() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ object MySqlSourceDatatypeTestOperations :
"NULL" to "null",
)

val tinyInt1Values =
mapOf(
"1" to "true",
"0" to "false",
"NULL" to "null",
)

val tinyInt1DefaultTrueValues =
mapOf(
"1" to "true",
"0" to "false",
"NULL" to "true",
)

val enumValues =
mapOf(
"'a'" to """"a"""",
Expand Down Expand Up @@ -294,6 +308,16 @@ object MySqlSourceDatatypeTestOperations :
tinyintValues,
LeafAirbyteSchemaType.INTEGER,
),
MySqlSourceDatatypeTestCase(
"TINYINT(1)",
tinyInt1Values,
LeafAirbyteSchemaType.BOOLEAN,
),
MySqlSourceDatatypeTestCase(
"TINYINT(1) NOT NULL DEFAULT 1",
tinyInt1DefaultTrueValues,
LeafAirbyteSchemaType.BOOLEAN,
),
MySqlSourceDatatypeTestCase(
"SMALLINT",
tinyintValues,
Expand Down
Loading
Loading