Skip to content

Commit fd98267

Browse files
authored
configure debezium to correctly convert column with default value whe… (#36011)
1 parent 95a8c8b commit fd98267

File tree

8 files changed

+22
-5
lines changed

8 files changed

+22
-5
lines changed

airbyte-cdk/java/airbyte-cdk/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ MavenLocal debugging steps:
166166

167167
| Version | Date | Pull Request | Subject |
168168
|:--------|:-----------|:-----------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|
169+
| 0.23.20 | 2024-03-12 | [\#36011](https://github.com/airbytehq/airbyte/pull/36011) | Debezium configuration for conversion of null value on a column with default value. |
169170
| 0.23.19 | 2024-03-11 | [\#35904](https://github.com/airbytehq/airbyte/pull/35904) | Add retries to the debezium engine. |
170171
| 0.23.18 | 2024-03-07 | [\#35899](https://github.com/airbytehq/airbyte/pull/35899) | Null check when retrieving destination state |
171172
| 0.23.16 | 2024-03-06 | [\#35842](https://github.com/airbytehq/airbyte/pull/35842) | Improve logging in debezium processing. |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.23.19
1+
version=0.23.20

airbyte-cdk/java/airbyte-cdk/db-sources/src/main/java/io/airbyte/cdk/integrations/debezium/internals/DebeziumPropertiesManager.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ public Properties getDebeziumProperties(
7676
// WARNING : Never change the value of this otherwise all the connectors would start syncing from
7777
// scratch.
7878
props.setProperty(TOPIC_PREFIX_KEY, sanitizeTopicPrefix(getName(config)));
79-
79+
// https://issues.redhat.com/browse/DBZ-7635
80+
// https://cwiki.apache.org/confluence/display/KAFKA/KIP-581%3A+Value+of+optional+null+field+which+has+default+value
81+
// A null value in a column with default value won't be generated correctly in CDC unless we set the
82+
// following
83+
props.setProperty("value.converter.replace.null.with.default", "false");
8084
// includes
8185
props.putAll(getIncludeConfiguration(catalog, config));
8286

airbyte-cdk/java/airbyte-cdk/db-sources/src/main/java/io/airbyte/cdk/integrations/debezium/internals/SnapshotMetadata.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public enum SnapshotMetadata {
1616
LAST_IN_DATA_COLLECTION,
1717
TRUE,
1818
LAST,
19-
FALSE;
19+
FALSE,
20+
NULL;
2021

2122
private static final Set<SnapshotMetadata> ENTRIES_OF_SNAPSHOT_EVENTS =
2223
ImmutableSet.of(TRUE, FIRST, FIRST_IN_DATA_COLLECTION, LAST_IN_DATA_COLLECTION);
@@ -35,6 +36,8 @@ public enum SnapshotMetadata {
3536
STRING_TO_ENUM.put("LAST_IN_DATA_COLLECTION", LAST_IN_DATA_COLLECTION);
3637
STRING_TO_ENUM.put("first_in_data_collection", FIRST_IN_DATA_COLLECTION);
3738
STRING_TO_ENUM.put("FIRST_IN_DATA_COLLECTION", FIRST_IN_DATA_COLLECTION);
39+
STRING_TO_ENUM.put("NULL", NULL);
40+
STRING_TO_ENUM.put("null", NULL);
3841
}
3942

4043
public static SnapshotMetadata fromString(final String value) {

airbyte-integrations/connectors/source-mssql/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
airbyteJavaConnector {
6-
cdkVersionRequired = '0.23.15'
6+
cdkVersionRequired = '0.23.20'
77
features = ['db-sources']
88
useLocalCdk = false
99
}

airbyte-integrations/connectors/source-mssql/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data:
99
connectorSubtype: database
1010
connectorType: source
1111
definitionId: b5ea17b1-f170-46dc-bc31-cc744ca984c1
12-
dockerImageTag: 4.0.0
12+
dockerImageTag: 4.0.1
1313
dockerRepository: airbyte/source-mssql
1414
documentationUrl: https://docs.airbyte.com/integrations/sources/mssql
1515
githubIssueLabel: source-mssql

airbyte-integrations/connectors/source-mssql/src/test-integration/java/io/airbyte/integrations/source/mssql/AbstractMssqlSourceDatatypeTest.java

+8
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ protected void initTests() {
344344

345345
}
346346

347+
addDataTypeTestData(
348+
TestDataHolder.builder()
349+
.sourceType("int")
350+
.airbyteType(JsonSchemaType.INTEGER)
351+
.addInsertValues("null", "1234", "7878")
352+
.addExpectedValues(null, "1234", "7878")
353+
.createTablePatternSql("CREATE TABLE %1$s(%2$s INTEGER NULL DEFAULT ((7878)), %3$s %4$s)")
354+
.build());
347355
}
348356

349357
}

docs/integrations/sources/mssql.md

+1
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ WHERE actor_definition_id ='b5ea17b1-f170-46dc-bc31-cc744ca984c1' AND (configura
327327

328328
| Version | Date | Pull Request | Subject |
329329
|:--------|:-----------|:------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------|
330+
| 4.0.1 | 2024-03-12 | [36011](https://github.com/airbytehq/airbyte/pull/36011) | Read correctly null values of columns with default value in CDC. |
330331
| 4.0.0 | 2024-03-06 | [35873](https://github.com/airbytehq/airbyte/pull/35873) | Terabyte-sized tables support, reliability improvements, bug fixes. |
331332
| 3.7.7 | 2024-03-06 | [35816](https://github.com/airbytehq/airbyte/pull/35816) | Fix query that was failing on a case sensitive server. |
332333
| 3.7.6 | 2024-03-04 | [35721](https://github.com/airbytehq/airbyte/pull/35721) | Fix tests |

0 commit comments

Comments
 (0)