Schema evolution is a reader problem
A format is compatible when every reader can decode bytes it did not write, so evolution means ignoring unknown fields and defaulting absent ones.
Compatibility belongs to the reader, not the file. A tagged format identifies each field by number or by name, so a reader can skip fields it does not recognise and fill in fields that are absent. Every consumer therefore constrains what producers may write. Change a reader's expectations and you change which bytes it accepts, even when the bytes stay the same.
Tagged formats such as protobuf and Thrift store a number for each field instead of its name. The reader holds a schema that maps each number to a field. A tag it knows is decoded into the matching field. A tag it does not know is skipped, and a field the record lacks receives the default the schema declares. Avro works by name instead: the reader takes the writer's schema alongside the data and matches each field to its own. Fields only the writer knew are ignored, and fields only the reader expects get defaults. Every step happens at decode time, on the reading side, so the bytes on disk never change when a new reader is deployed.
The abstraction hides who the schema must serve. The producer sees one consumer, but the schema must serve every consumer that will ever decode the data. Adding a required field asserts that every record, including records written before the field existed, contains it. A reader that enforces that requirement rejects the old ones. The failure runs like this. An ingest job built against the old schema reads rows from a new producer and works, because it ignores the unknown field and defaults the missing one. Then someone marks the field required and ships it. Every old row now fails to decode. Rolling back the reader does not help, since those rows were written under a schema that legitimately lacked the field. Nothing corrupted the data. Two readers disagreed about what could be missing, and the newer reader's expectation reached backward into history.
Add every new field as optional with a default. Never add a field as required, because a required field invalidates every old payload. Never reuse or renumber a tag: an old value in that slot is silently misread, and the decode still succeeds, which makes it the worst failure. Keep schemas in one registry and version every change, so every team can find the schema a writer used. When writers sit outside your control, let the writer's schema travel with the data and reconcile at read time. Before shipping, ask two questions. Can a reader that has never heard of this field decode the record? Can a reader that expects the field decode a record written without it? If either answer is no, the change is not compatible.
- Tag cost, first 15 fields
- 1 byte
- Cost of an optional field
- one tag and one default
- Payloads broken by a required field
- every old payload
- Compatibility directions
- 2
A tag is the number that identifies a field. For the first 15 fields it fits in one byte.
The new tag and default go into the reader's schema, and old readers skip the unknown tag.
A required field asserts that every record contains it, so records written earlier fail to decode.
Backward means new code reads old data, and forward means old code reads new data. Optional fields with defaults keep both working.
A team first treats a column addition like a change to a struct. The naive pipeline reads every data file, patches each record in memory to add the new column, and rewrites the whole dataset. That works on a small table, but one schema tweak now costs a full rewrite of everything.
The wall appears when readers disagree about what the old files mean. A reader that decodes by position sees a column added in the middle as a shift, so every later field lands one slot off. A rename then stops being a rename and becomes corrupted data, because the reader still reads the old position and gets the wrong value.
Iceberg's answer gives every column a stable id and lets each file carry the schema it was written with. The reader matches columns by id and reconciles the file's schema against the table's current one instead of guessing from position. Adding, dropping or reordering columns then changes metadata, and existing data files stay as they are.
The non-obvious lesson is that compatibility belongs to the reader, and the format's job is to make field identity permanent. Once ids never change, renames and inserts stop being rewrites. Field names can change freely because the id underneath them does not.