Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
0.10.0.0
-
None
-
None
Description
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.
Attachments
Issue Links
- duplicates
-
KAFKA-3803 JsonConverter deserialized Struct containing bytes field does not return true for equals()
- Open