Skip to content
BENIBIX Learn

Apache Avro

Also known as Avro, Avro Schema, Avro File

A small file type that keeps whole rows. The plan for the data rides along.

Think of it like

It is like a parcel with the packing list taped on top. You always know what is inside.

Example

An app sends each order as an Avro message. Months later, a field for coupon codes is added, and old readers still work.

Why it matters

Streams change shape over time. Avro's schema rules let a sender and a reader change at different times.

Definition

Apache Avro is an open file format that stores data row by row in a small binary form. Its schema is written in JSON and travels with the data. A reader uses the schema to decode each record. Fields can be added or removed over time, with rules that keep old and new readers working. It is popular for messages in event streams.

Example code

json
{"type": "record", "name": "Order",
 "fields": [
  {"name": "id", "type": "long"},
  {"name": "total", "type": "double"}]}
An Avro schema for an order. Every record is written and read with it.

Common mistake

Using Avro files for big reports. It stores rows, so a query on two columns still reads every field.

Key takeaways

  1. 1
    Row by row. Each record is stored whole.
  2. 2
    Schema included. The JSON schema travels with the data.
  3. 3
    Safe to change. Old and new readers keep working.

Compare