Tomas Zuklys created KAFKA-5972: ----------------------------------- Summary: Flatten SMT does not work with null values Key: KAFKA-5972 URL: https://issues.apache.org/jira/browse/KAFKA-5972 Project: Kafka Issue Type: Bug Components: KafkaConnect Affects Versions: 0.11.0.0 Reporter: Tomas Zuklys Priority: Minor Attachments: kafka-transforms.patch
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: {code} {A={D=dValue, B=null, C=cValue}} {code} The issue is in if statement that checks for null value. Current version: {code} 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; } ... {code} should be {code} 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; } {code} I have attached a patch containing the fix for this issue. -- This message was sent by Atlassian JIRA (v6.4.14#64029)