You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Randall Hauch (JIRA)" <ji...@apache.org> on 2016/06/07 21:50:21 UTC

[jira] [Created] (KAFKA-3804) Kafka Connect's Struct objects rehydrated with JSON converter are not equal

Randall Hauch created KAFKA-3804:
------------------------------------

             Summary: Kafka Connect's Struct objects rehydrated with JSON converter are not equal
                 Key: KAFKA-3804
                 URL: https://issues.apache.org/jira/browse/KAFKA-3804
             Project: Kafka
          Issue Type: Bug
          Components: KafkaConnect
    Affects Versions: 0.10.0.0
            Reporter: Randall Hauch
            Assignee: Ewen Cheslack-Postava


The {{equals(...)}} method on {{org.apache.kafka.connect.data.Struct}} currently uses {{Arrays.equals(value,o.value)}} to compare the array of field values to that of another. However, this only works when the elements in those arrays (e.g., the field values) are primitives or objects, but fails to work when they are arrays such as {{byte[]}}. 

Interestingly, the {{StructTest}} unit test populates all fields of type {{Schema.BYTES_SCHEMA}} using {{ByteBuffer}} object, which means the current logic works fine. However, the JSON converter rehydrates the {{Struct}} objects using {{byte[]}}, whereas the Avro converter rehydrates using {{ByteBuffer}}. This means that when a {{Struct}} containing a {{Schema.BYTES_SCHEMA}} or {{Schema.OPTIONAL_BYTES_SCHEMA}} field is serialized and then deserialized with the JSON converter, the rehydrated object will not be deemed "equal" to the original.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)