Data Engineering · Module 04
Data formats and file storage
- Lessons
- 10
- Free
- 1
- Reading
- ~3 h
Your progress
0 / 10 lessons done
Sign in to trackLessons
- Row and columnar storage: why layout mattersFreeEvery file format and engine in this course is either row-based or columnar, and the choice decides what each query pays. Knowing the layout lets you predict which jobs a store will do cheaply before you load a byte into it.
- CSV and JSON: simple but costly at scaleFiles between companies are still mostly CSV and JSON. Both look simple, and most bugs between a sender and a reader come from the parts the formats never pinned down.
- Parquet: columnar files for analyticsMost analytical data at rest is Parquet: exports, data lake files, the files under Iceberg and Delta tables. Whether a query over them reads 1% or 100% of the bytes is decided when the file is written, often by a job nobody looks at again.
- Avro and Protobuf: schemas for eventsKafka topics and CDC tools often carry Avro or Protobuf messages, and lakes store the same data as Parquet. Where each format keeps its schema decides who can read the data, and what breaks when it changes.
- Compression and encoding: smaller, faster filesEvery analytical file you write picks an encoding and a codec, usually by default. Those defaults decide how many bytes each query reads for the life of the data, and a sort order or one setting can change that several times over.
- Partitioning files by date and keyAlmost every data lake, export folder and lakehouse table splits its files by a key, usually a date. That folder layout decides which files a query never opens, and once readers depend on it, changing it means rewriting everything.
- The small files problemEvery pipeline that writes often, or splits its output into many folders, creates small files without anyone deciding to. The queries that read them slow down month by month, and the fix is cheapest when it is part of the design from the start.
- Schema evolution: changing data without breaking jobsEvery source a pipeline reads changes shape over time: app releases, new columns, wider types. Old files and old app versions don’t change with it, so every reader must handle every shape it will ever meet.
- Object storage for data: buckets, prefixes and costsAlmost every data platform keeps its files in object storage. Its rules differ from a disk: no rename, no folders, and a bill per request, and pipelines written as if it were a disk lose data or money.
- Choosing a file format for your workloadEvery pipeline has files going out to partners, events in flight, tables for analysts and records kept for audits. Picking one format for all of them makes some of them slow, unreadable or unprovable; picking per workload keeps each one cheap.
Practise with
No tools or paper guides for this module yet.
Terms this module teaches 36
Open glossaryApache Avro
A row-oriented binary data format whose records hold only values, in the order a separate JSON schema lists them, so every reader needs the writer’s schema.
Avro object container file
An Avro file that stores the writer’s schema once in its header, then blocks of records separated by a sync marker.
Bit-packing
Storing small numbers in exactly as many bits as the largest one needs, packed together across byte boundaries.
Cardinality (of a column)
The number of different values a column holds. Low-cardinality columns suit partitioning; high-cardinality ones suit sorting.
Character encoding
The rule that turns text into bytes and back, such as UTF-8 or Latin-1. Reading bytes with a different encoding than they were written in gives wrong characters, usually without an error.
Column chunk
All the values of one column within one row group of a Parquet file, stored together as one contiguous byte range.
Compression codec
A general-purpose algorithm, such as Snappy, LZ4, gzip or Zstd, that shrinks a block of bytes and restores it exactly when read.
CSV dialect
The choices a CSV file makes that the format itself leaves open: delimiter, quote and escape characters, line ending, whether there is a header line, text encoding, and how missing values are written.
Delta encoding
Storing the first value of an ordered column and then only the difference from each value to the next, which needs far fewer bits when values are close.
Dictionary encoding
Storing each distinct value of a column once in a list, and replacing every value with its small position number in that list.
Field alias
An old name listed on a field in an Avro reader’s schema, so data written under that name is read into the field.
Field number
The number a Protobuf schema gives each field; it is written before the field’s value in place of its name, so it must never be reused for another field.
File compaction
Rewriting many small data files into fewer large ones, so queries open fewer files and read fewer footers.
Forward compatibility
A schema change is forward compatible when readers built for the old schema can still read data written with the new one.
Hive partitioning
A file layout that puts files in folders named column=value, so readers can treat the folder name as a column and skip folders that can’t match a filter.
HTTP range request
An HTTP read that asks a server for one byte range of a file instead of the whole file.
ISO 8601
The international standard for writing dates and times as text, from the largest unit to the smallest, optionally with an offset from UTC.
Lifecycle rule
A rule on an object storage bucket that deletes objects, moves them to cheaper storage or aborts unfinished uploads after a set time.
List request
A request that asks object storage which keys exist under a prefix; S3 returns at most 1,000 keys per request, so longer lists come back page by page.
Page (Parquet)
A slice of a column chunk that is encoded and compressed on its own; the smallest piece a Parquet reader decompresses.
Partition pruning
Skipping whole partitions, such as folders of files, because their partition key value can’t satisfy a query’s filter, before reading any of their data.
PAX layout
A hybrid layout that groups rows into blocks and stores each block column by column, so scans read few columns and one row’s values stay close together.
Projection pushdown
Reading only the columns a query names, inside the scan, so the other columns are never read from storage.
Reader’s schema
In Avro, the schema a reading program expects; the library converts each record from the writer’s schema into it.
Row-oriented storage
A storage layout that keeps all the values of one record together, so a whole row can be read or written in one place.
Run-length encoding
Storing a run of the same value repeated back to back as one value and a count.
Schema evolution
Changing a data set’s schema over time while data written under earlier schemas stays as it is, so readers must handle every version.
Schema resolution
Avro’s rules for reading data written with one schema into another: fields matched by name, writer-only fields ignored, reader-only fields given their default, and some types widened.
Self-describing format
A file format that stores its own schema with the data, so a reader can learn each field’s name and type from the file alone.
Small files problem
The extra time and cost of reading data spread over many small files, because each file adds fixed work (listing, opening, reading its footer) before any of its data is read.
Storage class
An object storage setting on each object that trades the monthly price against how quickly, and at what retrieval cost, the object can be read.
Target file size
The file size a writer or compaction job aims for, large enough that per-file overhead is a small share of reading the file and small enough to rewrite and process in parallel.
Type promotion
Reading a value written as a narrower type as a wider one, such as an int as a long, which loses nothing.
Varint
A way to write an integer in 7-bit groups, one per byte, so small numbers take fewer bytes than large ones.
Writer’s schema
In Avro, the exact schema used to write the data, which every reader needs in order to decode it.