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

Anders Sundelin commented on AVRO-3515:
---------------------------------------

I second that. As the spec says that the doc portion of a schema may be dropped 
during serialization, it seems dangerous to include it into the equality check.

Perhaps there are ways to make this more obvious though (I've sometimes marked 
such fields transient, either via keywords or annotations)...

> 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)

Reply via email to