They will be compatible as long as you use the writer and reader schemas to 
decode the message...
(The symbol names are used to map between your writer and reader schema…)

—Z

> On May 30, 2018, at 8:35 AM, Arnaud BOS <[email protected]> wrote:
> 
> Quick question: is reordering the values of an enum a backward compatible 
> change?
> 
> Per the Avro 1.8.2 documentation: "An enum is encoded by a int, representing 
> the zero-based position of the symbol in the schema."
> 
> If my enum is: 
> {"type": "enum", "name": "Foo", "symbols": ["A", "B", "C", "D"] }
> And I update it to
> {"type": "enum", "name": "Foo", "symbols": ["A", "B", "C", "E", "F", "D"] }
> 
> If a writer with the older schema will produce messages using enum value "D" 
> encoded as int 3.
> Then a reader with the newer schema will consume messages with value 3 and 
> decoded it as enum value "E".
> 
> If this is the case, then reordering enums is just as non-backward compatible 
> as adding new values is non-forward compatible, is it correct?

Reply via email to