Hacker News new | ask | show | jobs
by spenczar5 1120 days ago
I don't really understand your summary for record types; it doesn't match with my experience of Avro schema evolution.

Avro's schema resolution rules [0] for record types seem to implement asymmetry almost exactly. It's just that this is done by having separate reader and writer schemas, which is less ergonomic and clear.

To add a new required field, you add it as a *required* field to the writer's schema. To do this asymmetrically, you can make it an *optional* field in the reader's schema, as a union with null. Once all clients are compliant, you can change the reader schema to replace the union with a plain type.

To remove a required field, you can go through this same dance. You can also always delete a field from the reader side, and any written data under that tag will be ignored.

Regarding union and enums: a nit is that unions are tagged, at least on the wire [1]. The writer-specified fallback is an important difference though, I definitely agree with that, and it seems like a genuinely novel improvement.

---

[0] https://avro.apache.org/docs/1.11.1/specification/#schema-re...

[1] https://avro.apache.org/docs/1.11.1/specification/#unions-1