ADD: add replace.null.with.default for JdbcSink #1433
+67
−21
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
When used with Kafka connect, there are cases where null values in the record are changed to default values.
In kafka-connect library v3.5,
replace.null.with.default
option was added to prevent null values from always being replaced with default values when converting json.But, the column constraints related to default values still remain in the record, so null values are entered as default values when building insert/update queries in JdbcSink.
I don't think there is a problem with the current query build logic where null values are replaced with default values if there is a default value constraint. However, since this connector used with kafka-connect and kafka-connect supports replace.null.with.default, so I think it is necessary to support this option.
Solution
Add
replace.null.with.default
option to choose whether null values should be changed to default values or not.Does this solution apply anywhere else?
If yes, where?
Test Strategy
Testing done:
Release Plan