kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "siva santhalingam (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KAFKA-5972) Flatten SMT does not work with null values
Date Sat, 30 Sep 2017 18:27:00 GMT

    [ https://issues.apache.org/jira/browse/KAFKA-5972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16187181#comment-16187181
] 

siva santhalingam commented on KAFKA-5972:
------------------------------------------

Hi [~tomas.zuklys@gmail.com] Can i assign this to myself? Thanks!

> 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, 0.11.0.1
>            Reporter: Tomas Zuklys
>            Priority: Minor
>              Labels: easyfix, patch
>         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)

Mime
View raw message