[
https://issues.apache.org/jira/browse/AVRO-3138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17499113#comment-17499113
]
Ryan Skraba commented on AVRO-3138:
-----------------------------------
I think there's a larger issue here – if I understood correctly, the "order of
declaration" doesn't have any guarantee across JDK across versions, which is
why the change was made to sort fields alphabetically.
There's a short discussion with regards to pulsar:
[https://www.mail-archive.com/[email protected]/msg04674.html]
Two workarounds might be to either
# annotate your reflected class with the explicit @AvroSchema annotation you
require, or
# use a reader and writer schema to automatically map the fields from the
schema that the writer is using and the schema that the reader is using.
Both of those are pretty clunky solutions. Alternatively, we could provide a
system property to disable "deterministic" sorting of field names (and suffer
the consequences if the JVM decides to change the order of declared fields in
your environment), or design something like an {{@AvroFieldOrder}} annotation
to help make the field order explicitly.
Would any of these be a satisfactory alternative for you?
> Incompatibility in the generation of schema between versions 1.9.x and 1.10.x
> ------------------------------------------------------------------------------
>
> Key: AVRO-3138
> URL: https://issues.apache.org/jira/browse/AVRO-3138
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.10.0, 1.10.1, 1.10.2
> Reporter: Thiago Gutenberg Carvalho da Costa
> Priority: Critical
> Attachments: avro-schema-issue.zip
>
>
> During the generation of the schema with the ReflectData class, the order of
> the record fields in the generated schema is changing between version 1.9.2
> and 1.10.2
> Attached follows a project with a simple test demonstrating the problem.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)