Skip to content

[FLINK-36999][cdc-source-connectors] When the source type is oracle and field type is nember and the value is null, a null pointer exception occurs during deserialization. #3833

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

Merged
merged 2 commits into from
May 15, 2025
Merged
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 @@ -188,6 +188,10 @@ protected DataType inferBytes(Object value, Schema schema) {
protected DataType inferStruct(Object value, Schema schema) {
Struct struct = (Struct) value;
if (VariableScaleDecimal.LOGICAL_NAME.equals(schema.name())) {
if (struct == null) {
// set the default value
return DataTypes.DECIMAL(DecimalType.DEFAULT_PRECISION, DecimalType.DEFAULT_SCALE);
}
SpecialValueDecimal decimal = VariableScaleDecimal.toLogical(struct);
BigDecimal bigDecimal = decimal.getDecimalValue().orElse(BigDecimal.ZERO);
return DataTypes.DECIMAL(bigDecimal.precision(), bigDecimal.scale());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ void testConsumingNumericColumns(boolean parallelismSnapshot) throws Exception {
statement.execute(
"INSERT INTO debezium.test_numeric_table "
+ "VALUES (11000000001, 1, 99, 9999, 987654321, 20000000000000000001, 987654321.87654321, 2147483648, 1024.965, 1024.965)");
statement.execute(
"INSERT INTO debezium.test_numeric_table "
+ "VALUES (11000000002, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)");
}

String sourceDDL =
Expand Down Expand Up @@ -709,7 +712,8 @@ void testConsumingNumericColumns(boolean parallelismSnapshot) throws Exception {
List<String> expected =
Arrays.asList(
"+I[11000000000, false, 98, 9998, 987654320, 20000000000000000000, 987654321.12345678, 2147483647, 1024.955, 1024.955]",
"+I[11000000001, true, 99, 9999, 987654321, 20000000000000000001, 987654321.87654321, 2147483648, 1024.965, 1024.965]");
"+I[11000000001, true, 99, 9999, 987654321, 20000000000000000001, 987654321.87654321, 2147483648, 1024.965, 1024.965]",
"+I[11000000002, null, null, null, null, null, null, null, null, null]");

List<String> actual = TestValuesTableFactory.getRawResultsAsStrings("test_numeric_sink");
Assertions.assertThat(actual).containsExactlyInAnyOrderElementsOf(expected);
Expand Down
Loading