Current state: Accepted
Discussion thread: https://lists.apache.org/thread/lxfq8y8co76mjwxhowwx6cjl0hw1mxpy
JIRA:
Release: 3.5.0
In particular, if we use Debezium to stream changes out of a table, t1, in mysql:
create table t1 { name varchar(40) not null, create_time datetime default '1999-01-01 11:11:11' null, update_time datetime default '1999-01-01 11:11:11' null } |
INSERT INTO `t1` (`name`, `update_time`) VALUES ('kafka', null); |
the record will store in MySQL as:
{ "name": "kafka", "create_time": "1999-01-01 11:11:11", "update_time": null } |
{ "name": "kafka", "create_time": "1999-01-01 11:11:11", "update_time": "1999-01-01 11:11:11" } |
Add a configuration to JsonConverter:
Name: replace.null.with.default
Description: Whether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used.
Type: Boolean
Default: true
Update JsonConverter and JsonConverterConfig to handle the new configuration. It will affect serialization when the converter runs in a source pipeline and deserialization in sink pipelines.
The new configuration keeps the current behavior by default so it will not affect existing users. Users can optionally opt-in the new behavior by setting the configuration to false.
null
on a null