[
https://issues.apache.org/jira/browse/AVRO-3515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534301#comment-17534301
]
Martin Tzvetanov Grigorov commented on AVRO-3515:
-------------------------------------------------
The [spec|https://avro.apache.org/docs/current/spec.html#Schema+Resolution]
says:
{code:java}
A schema's "doc" fields are ignored for the purposes of schema resolution.
Hence, the "doc" portion of a schema may be dropped at serialization. {code}
I believe the doc is omitted intentionally from the equality check.
> Schema.Field equals method does not include the doc attribute
> -------------------------------------------------------------
>
> Key: AVRO-3515
> URL: https://issues.apache.org/jira/browse/AVRO-3515
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.11.0
> Reporter: Dominik Hons
> Priority: Minor
> Attachments: AVRO-3515.patch
>
>
> The org.apache.avro.Schema.Field class contains attribute {*}doc{*}. However,
> it is not included in the equals method, which results in problems with
> schema evolution.
>
> This test currently fails, because both Fields are considered equal.
> {code:java}
> @Test
> public void testFieldEquality() {
> Schema schema = Schema.createRecord("r", "doc", "namespace", false);
> Field fieldWithDoc = new Field("f", schema, "doc");
> Field fieldWithoutDoc = new Field("f", schema);
> assertNotEquals(fieldWithDoc, fieldWithoutDoc);
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)