Details
Description
Hi,
I noticed a bug in Flatten SMT while doing tests with different SMTs that are provided out-of-box.
Flatten SMT does not work as expected with schemaless JSON that has properties with null values.
Example json:
{A={D=dValue, B=null, C=cValue}}
The issue is in if statement that checks for null value.
Current version:
for (Map.Entry<String, Object> entry : originalRecord.entrySet()) { final String fieldName = fieldName(fieldNamePrefix, entry.getKey()); Object value = entry.getValue(); if (value == null) { newRecord.put(fieldName(fieldNamePrefix, entry.getKey()), null); return; } ...
should be
for (Map.Entry<String, Object> entry : originalRecord.entrySet()) { final String fieldName = fieldName(fieldNamePrefix, entry.getKey()); Object value = entry.getValue(); if (value == null) { newRecord.put(fieldName(fieldNamePrefix, entry.getKey()), null); continue; }
I have attached a patch containing the fix for this issue.
Attachments
Attachments
Issue Links
- is superceded by
-
KAFKA-6605 Flatten SMT does not properly handle fields that are null
- Resolved
- links to