Krzysztof Barczynski created AVRO-4036:
------------------------------------------
Summary: GenericData.Array.equals() method does not adhere to
standards
Key: AVRO-4036
URL: https://issues.apache.org/jira/browse/AVRO-4036
Project: Apache Avro
Issue Type: Bug
Components: java
Affects Versions: 1.12.0
Environment: Avro 1.12.0
JDK 21
Maven
Reporter: Krzysztof Barczynski
There is a unit test which shows what's the issue:
*
[https://github.com/krisso-rtb/avro-custom-logical-types/blob/avro-1.12.0-test-case-for-weird-equals/custom-logical-types-used/src/test/java/com/rtbhouse/custom/logical/types/SerializeDeserializeTest.java]
Most important part is block of code around line 40.
In version 1.12.0 implementation of *equals()* has been changed to
{code:java}
public boolean equals(final Object o) {
if (!(o instanceof Collection)) {
return false;
}
return GenericData.get().compare(this, o, this.getSchema()) == 0;
}
{code}
which fails when logical types are used.
More precisely: when record's field is an array of union of "null" and logical
type.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)