The Lake
How a lakehouse actually works, from bytes in an object store to a vectorized scan: the Delta and Iceberg protocols, Parquet, Unity Catalog, Spark internals and the Databricks platform, down to the algorithms, with every claim tied to a spec or a source line.
Start at chapter 1: Warehouses, lakes and the lakehouse → Or jump to the flagship: 10. Delta commit and optimistic concurrency
39 chapters · 39 complete · 0 draft · 0 outlined
From a query to bytes in S3
Every layer a query passes through on its way down. Click one to see what it does and which chapters cover it.
Query engineTable format and catalogFiles and storage
Step through it
Diagrams are simulators: change the inputs and watch the protocol run, step by step.
Check yourself
Every chapter has checkpoint quizzes. Answers feed a spaced-repetition queue on the Review page.
Go to the source
Citations link to PROTOCOL.md, the Iceberg spec, parquet-format and source code, pinned to a commit.
Contents
Where to start. Read 1. Warehouses, lakes, lakehouse first. After that, any of these opens a part of the book:
- 3. S3 semantics · Object storage
- 5. Parquet file layout · Parquet and columnar files
- 29. Spark SQL lifecycle · Query execution
Each chapter's page shows what it builds on and what it leads to. Read any time: 2. People, papers and releases, 38. How to read the specs, 39. Glossary and bibliography.
Part 1 Foundations and history
Why lakehouses exist, and who built the pieces.
- 1 Warehouses, lakes and the lakehouse Why the two-tier architecture of a data lake feeding a warehouse broke down, and what exactly a lakehouse adds on top of files in object storage. The argument of the CIDR 2021 paper, and a map of the book. complete read
- 2 People, papers and releases A single annotated timeline of the systems in this book: who built them, where, when, and which paper to read. Every entry links to the page that dates it. complete read
Part 2 Object storage
The substrate: what S3 does and does not promise.
- 3 S3 semantics: consistency, atomicity and cost Exactly what an object store promises: a flat key space, sorted and paginated LIST, atomic single-object PUT, strong read-after-write since December 2020, no rename, conditional writes since 2024, and request rates that make file counts matter. complete read
- 4 Atomic commits on object stores How a table format gets exactly one winner per version out of storage with no transactions: atomic rename, generation preconditions, a per-JVM lock, DynamoDB as an external arbiter, S3 conditional writes with write-id reconciliation, and catalogs that compare-and-swap a pointer. complete read
Part 3 Parquet and columnar files
Bytes on disk: layout, encodings, statistics.
- 5 Parquet file layout A Parquet file byte by byte: magic, row groups, column chunks, pages, the Thrift-encoded footer, and how a reader finds what it needs with a tail read and one range per column chunk. complete read
- 6 Parquet encodings and compression Every encoding in the spec, with worked bytes: PLAIN, the RLE/bit-packing hybrid, dictionary, DELTA_BINARY_PACKED, DELTA_LENGTH_BYTE_ARRAY, DELTA_BYTE_ARRAY, BYTE_STREAM_SPLIT, and how compression codecs layer on top. With measured sizes for each encoding and codec. complete read
- 7 Nested data: repetition and definition levels How Parquet stores structs, lists and maps in flat columns using the Dremel record shredding algorithm, how a reader reassembles records, the LIST and MAP logical types, and how Variant values are shredded into typed columns. complete read
- 8 Statistics, page indexes and bloom filters The metadata that lets readers skip data: column chunk statistics and their sort-order rules, the column and offset index (page index), dictionary filtering, split block Bloom filters, and the order in which parquet-java and Spark apply them. complete read
Part 4 Delta Lake protocol
A transaction log of JSON actions over Parquet.
- 9 The Delta log: actions and replay The _delta_log directory, every action type and its fields, and the reconciliation rules that turn a sequence of commits into a snapshot. complete read
- 10 Delta commit and optimistic concurrency ★ flagship How a Delta transaction turns into exactly one new version, what happens when two writers race for it, and the precise sequence of conflict checks that decides who has to give up. complete read
- 11 Checkpoints, sidecars and log compaction How a reader finds a snapshot without replaying every commit: _last_checkpoint, classic, multi-part and V2 (UUID-named) checkpoints, sidecar files, log compaction files and metadata cleanup. complete read
- 12 Protocol versions and table features How Delta evolves without breaking readers: minReaderVersion and minWriterVersion, table features at reader version 3 and writer version 7, supported vs active features, how a client decides it may read or write, and how the Spark connector drops a feature. complete read
- 13 Deletion vectors and row tracking Merge-on-read in Delta: the deletion vector descriptor, the Roaring bitmap storage format, inline vs on-disk DVs, how DELETE writes them and scans apply them, and row IDs and row commit versions. complete read
- 14 Catalog-managed tables and coordinated commits When the catalog, not the filesystem, decides which commit is version v: proposed, staged, inline, ratified and published commits, the three commit options, how readers combine the catalog with a LIST, and what the Spark connector does differently. complete read
- 15 Change data feed, column mapping and type widening Three features that change what readers must do: cdc files and the change type column, column mapping by name or id, and type widening metadata. Each one separates what the log says from what the Parquet files hold. complete read
Part 5 Apache Iceberg spec
A tree of metadata files and a catalog pointer.
- 16 The Iceberg metadata tree Iceberg from the root pointer down: the table metadata file, snapshots, the manifest list, manifests and data files, sequence-number inheritance, and how a scan prunes the tree before it reads a byte of data. complete read
- 17 Iceberg commits and optimistic concurrency How an Iceberg commit works from the inside: building new metadata, the check-and-put in the catalog, the retry loop that re-applies an operation to a newer snapshot, and the validations that decide whether the retried operation is still correct. complete read
- 18 Hidden partitioning and partition evolution Partition transforms (identity, bucket, truncate, year, month, day, hour, void), why partition values live in manifests and not in paths, how a filter on a source column is projected to partition predicates, and how specs evolve without rewriting data. complete read
- 19 Schemas, field IDs and sort orders Why Iceberg tracks columns by ID, the schema evolution rules that follow, type promotion and how old statistics are decoded, default values, reading files that have no IDs, and sort orders and how Spark uses them when writing. complete read
- 20 Row-level deletes: v2 delete files and v3 deletion vectors Merge-on-read in Iceberg: position deletes, equality deletes, the sequence-number scope rules that decide which delete applies to which file, how readers apply them, the v3 move to deletion vectors in Puffin files, compaction, and row lineage. complete read
- 21 The REST catalog protocol The Iceberg REST catalog spec: configuration, loading a table, credential vending, commits as requirements plus updates, what the server does with them, failures, idempotency keys, multi-table transactions and server-side scan planning. complete read
Part 6 Interoperability
One copy of data, several table formats.
Part 7 Catalogs and governance
Unity Catalog and the catalog as commit authority.
- 23 Unity Catalog: object model and architecture Metastores, catalogs, schemas, tables, volumes, functions and models; managed vs external tables; storage credentials and external locations; and Unity Catalog as the commit authority for managed Delta tables, from the open-source server's code. complete read
- 24 Governance: privileges, credential vending and lineage How access control is enforced end to end: the privilege model and its inheritance rule, the authorization expression behind each API call, short-lived path-scoped credentials for engines, row filters and column masks, and lineage. complete read
Part 8 Data layout
Partitioning, clustering, skipping, compaction.
- 25 Partitioning Hive-style partition directories, what Delta and Iceberg record instead, how a partitioned Spark write turns into files, static and dynamic partition pruning, choosing a partition column, and partitioning's effect on concurrent writes. complete read
- 26 Data skipping, Z-order and space-filling curves Per-file min/max statistics in the Delta log and Iceberg manifests, how a predicate becomes a file filter, why skipping depends on layout, and how OPTIMIZE ZORDER BY uses range ids, bit interleaving and range partitioning to co-locate several columns; Hilbert curves as the alternative. complete read
- 27 Liquid clustering Clustering without partitions and without full rewrites: the Clustered Table feature and its domain metadata, the clusteringProvider field, ZCubes, and how Delta's incremental OPTIMIZE picks unclustered files and small ZCubes, packs them into bins and Hilbert-clusters each bin. complete read
- 28 Compaction, OPTIMIZE and VACUUM Keeping a table healthy: what small files cost, how OPTIMIZE picks and bin-packs files and commits with dataChange=false, auto compaction and optimized writes, and how VACUUM decides what is safe to delete given tombstones, retention and time travel. Iceberg's rewrite, snapshot expiry and orphan removal for comparison. complete read
Part 9 Query execution
From SQL text to vectorized scans and shuffles.
- 29 The Spark SQL query lifecycle From SQL text to a running plan in Spark 4.0: parsing, analysis with fixed-point rule batches, Catalyst's logical optimizations, size statistics and join selection, EnsureRequirements and whole-stage codegen, and how adaptive query execution re-plans with runtime statistics. complete read
- 30 DataSource V2 and scan planning for tables How Delta and Iceberg plug into Spark 4.0: the DSv2 read API, where the optimizer pushes filters, Delta's V1 fallback and PrepareDeltaScan, Iceberg's SparkScanBuilder, how files become tasks, and the runtime filters: dynamic partition pruning, Bloom filters and Databricks dynamic file pruning. complete read
- 31 The vectorized Parquet reader and columnar batches How Spark 4.0 reads Parquet a batch at a time into ColumnVectors: the read loop, decoding definition levels and RLE dictionary ids run by run, lazy dictionary decoding, the on-heap vector layout, how codegen turns batches back into rows, and the Arrow format Spark uses to exchange columnar data. complete read
- 32 Vectorized execution: from X100 to Photon Why processing vectors of values beats tuple-at-a-time interpretation, how data-centric code generation does the same job differently, what the comparison between them found, and where Spark's whole-stage codegen and Databricks' Photon sit. complete read
- 33 Shuffle, joins and skew How an exchange hashes rows to reducers and writes map output files, how JoinSelection chooses among broadcast hash, shuffled hash, sort-merge and nested loop joins, and how AQE re-plans joins, coalesces partitions and splits skewed ones at runtime. complete read
- 34 MERGE, UPDATE and DELETE internals How row-level operations execute on Delta and Iceberg: finding touched files, copy-on-write rewrites, merge-on-read with deletion vectors, and what each does to the read set and conflicts. complete read
- 35 Streaming reads and writes on table formats Structured Streaming with Delta and Iceberg as sources and sinks: how the Delta source turns the log into offsets, how rate limits split commits, what happens when the source table is updated, and how the checkpoint and transaction identifiers make the sink exactly-once. complete read
Part 10 The Databricks platform
Photon, predictive optimization, and the managed pieces.
- 36 Photon Databricks' native vectorized engine: why it was built in C++, how its column batches and kernels adapt per batch, how its hash table probes, how it enters a Spark plan, and how it shares memory with Spark. complete read
- 37 Managed table features on Databricks The Databricks-specific layer: predictive optimization, file size autotuning, auto compaction and optimized writes, row-level concurrency, the disk cache and catalog commits, and how each maps to open protocol features. complete read
Part 11 Appendices
Reading the specs, glossary, bibliography.
- 38 How to read the specs A guide to PROTOCOL.md, the Iceberg spec and parquet-format: how each is organized, how it expresses versions and compatibility, and how to get from a sentence in it to the code that implements it. complete read
- 39 Glossary and bibliography Every core term in the book with a one-line definition and the chapter that explains it, the pinned specs and source, and every source the chapters cite, grouped by part. complete read