Status
Current state: Accepted
Discussion thread: https://lists.apache.org/thread/lxfq8y8co76mjwxhowwx6cjl0hw1mxpy
JIRA: - KAFKA-8713Getting issue details... STATUS
Release: 3.5.0
Motivation
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" }
Public Interfaces
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
Proposed Changes
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.
Compatibility, Deprecation, and Migration Plan
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.
Rejected Alternatives
null
on anull