> ## Content Index
> Fetch the complete content index at: https://datajutsu.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# An Avro Logical Type Is a Label the Parser Discards (and the Wire Never Knew)
- URL: https://datajutsu.com/avro-logical-types/
- Published: 2026-10-24T00:57:10.000Z
- Updated: 2026-10-24T00:57:10.000Z
- Author: Data Jutsu

Avro's schema language has a line that looks like it changes what a field is. You write an int field, add a logicalType of date, and the intent is clear: this int is days since the epoch, not a count. I measured what happens to that line, and it does not happen much at all. The parser reads the schema, and in the parsed schema the label is gone. The field that came in as an int with a date label comes back out as a plain int, the attribute accepted and discarded, and the round trip of the schema through the library does not bring it back. The label is not stored anywhere the decoder can see it.

The wire agrees with the parser, because the bytes were never going to carry the label anyway. A date field holding 20000 days encodes to the exact same bytes as a plain int holding 20000, the zigzag varint, and a reader whose schema says plain int reads those bytes back as 20000 with zero error. A timestamp-millis field holding 1577836800000 is the same as a plain long holding that number, byte for byte. The logical type never touches the wire. In protobuf the schema label is where a lot of the difference between two fields lives, and at least the parser stores the options it reads. Here the label exists in the schema file, for the humans and the other tools that read the file, and nothing between the file and the bytes keeps it.

The part that surprises people is that the parser does not even check the label is a real one. I wrote a schema with a logicalType of banana, a name from nowhere, and it parsed with the same zero complaint as date and time-millis and uuid, every one of them accepted, every one of them reduced to the plain primitive underneath. There is no registry lookup, no error for a spelling mistake, no warning that the name does not exist. The attribute is decorative, in the sense that it sits there, is read, and is thrown away, and the only thing that will ever notice the misspelling is another system that happens to validate against the spec.

The library behaves the same way it treats the primitive, which is the whole point. Feed a date field a JavaScript Date object and it throws, invalid int, showing the ISO string the Date was coerced to. Feed it the ISO string directly and it throws the same, the field wants a number, and it does not know it is a date. Feed a timestamp-millis field a Date and it throws the same way. A decimal field fed the number 12345 throws, and fed the string 123.45 throws the same, only raw bytes are accepted, and they are treated as plain bytes. The spec says a decimal is a big-endian two's-complement integer scaled by a power of ten, and the library never computes any part of that, it just moves the bytes. So the field that is supposed to be a date or a decimal behaves, in the code that actually runs, exactly like the int or the bytes it is built from.

That is where two pipelines disagreeing about a field goes to die quietly. One system writes an int that its schema file calls a date, another system reads it as an int because its copy of the schema has no label, or the label got dropped when someone rewrote the schema by hand, which the parser would not have stopped, because it drops it anyway. The bytes are the same in both worlds, the decode succeeds in both worlds, and the JSON that comes out is silently a number where one side expects a date string. There is no error at any layer, not the file, not the wire, not the decoder, and the disagreement is only visible by opening the two schema files and diffing them, which is the one place the label still lives. The rest of this, how the bytes move between the two formats and where the integer encodings split, is in the [avro versus protobuf post](https://datajutsu.com/avro-vs-protobuf-bytes/), and how the reader matches fields by name when the schema changes at all is in the [schema evolution post](https://datajutsu.com/avro-schema-evolution/). The protobuf side of the tool at [proto.datajutsu.com](https://proto.datajutsu.com/?ref=datajutsu.com) shows the same idea from the other format, where the label does at least survive the parser even if the wire ignores it.