Chapter 10 of 12
Course Progress0 of 12 completed (0%)

Data Engineering · Chapter 10 · ~15 min · Advanced

Data Lakes, Warehouses & Lakehouses: Delta Lake & Iceberg

Understand the convergence of storage and compute: file formats meet database transactions with Apache Iceberg and Delta Lake. ACID guarantees on S3 object storage, time travel, compaction, and partition evolution.

  • Trace the architectural evolution from Warehouses to Data Lakes to Open Lakehouses
  • Understand ACID transaction logs on object storage (Delta Log and Iceberg Metadata Trees)
  • Execute Time Travel queries and schema evolution without physical table rewrites
  • Implement table optimization strategies: file compaction (bin-packing) and Z-Ordering

Data Lakes, Warehouses & Lakehouses: Delta Lake & Iceberg: learn it visually

Understand the convergence of storage and compute: file formats meet database transactions with Apache Iceberg and Delta Lake. ACID guarantees on S3 object storage, time travel, compaction, and partition evolution.

Data Lakes, Warehouses & Lakehouses: Delta Lake & IcebergUnderstand the convergence of storage and compute: file formats meet database transactions with Apache Iceberg and Delta Lake. ACID guarantees on S3 object storage, time travel, compaction, and partition evolution.UNDERSTANDData LakesFOLLOW THE FLOWWarehousesAPPLY ITLakehousesData Lakes, Warehouses & Lakehouses: Delta Lake & IcebergUnderstand the convergence of storage and compute: file formats meet database transactions with Apache Iceberg and Delta Lake. ACID guarantees on S3 object storage, time travel, compaction, and partition evolution.UNDERSTANDData LakesFOLLOW THE FLOWWarehousesAPPLY ITLakehouses

1Everyday Intuition: The Filing Cabinet with Git Version Control

To understand the Lakehouse architecture, compare the three historical storage paradigms:

1. Data Warehouse

The Polished Mahogany Cabinet

Proprietary, highly structured, lightning-fast SQL queries, but extraordinarily expensive and incapable of storing unstructured video, audio, or raw semi-structured JSON payloads.

2. Data Lake

The Giant Cardboard Storage Room

Cheap object storage (S3/GCS) holding unlimited petabytes. But without transactions, it quickly turned into a "data swamp": unindexed files, partial write crashes, and zero ACID guarantees.

3. Open Lakehouse

Git Commit Log on S3

Apache Iceberg and Delta Lake marry cheap S3 storage with a formal ACID transaction log. Every commit is atomic, tables support historical time-travel, and multiple engines (Spark, Trino, DuckDB) share one open format.

Concept Check

Why can raw cloud object storage (Amazon S3 / Google Cloud Storage) not provide database ACID guarantees on its own?

2Under the Hood: Apache Iceberg Metadata Architecture

In Apache Iceberg, the "table" is not a directory of files; it is an immutable metadata snapshot tree:

1. Iceberg Catalog

Tracks the current metadata pointer for each table (e.g. v4.metadata.json). When an atomic transaction commits, the catalog updates its pointer via Optimistic Concurrency Control (OCC).

2. Manifest List

Captures a snapshot in time. Lists all manifest files active in that version along with partition field summaries.

3. Manifest Files

Store direct pointers to physical data files (Parquet/ORC) and record exact column statistics (min/max bounds, null counts) for ultra-fast query predicate pushdown.

Wrong idea: Encode partition dates into physical S3 directory paths

s3://bucket/data/year=2026/month=11/day=20/ → Changing to hours requires rewriting 100TB!Physical directory coupling · Fragile partition pruning queries

Organizing files as '/year=2026/month=11/day=20/'. When users query 'WHERE event_time > ...', query engines scan all directories unless users also remember to explicitly filter the physical partition string.

Real system: Iceberg Hidden Partitioning decouples logical transforms from layout

Iceberg Metadata: days(event_time) → Zero directory scans requiredPartition evolution without data rewrite · Seamless query pruning

Iceberg applies partition transforms (e.g. days(event_time)) directly in the metadata catalog. Users write standard queries and Iceberg prunes files automatically.

Concept Check

How do Delta Lake and Apache Iceberg execute 'Time Travel' historical queries without duplicating entire datasets?

3Hands-On: Test Snapshots, Bin-Packing & VACUUM

Interact with the Lakehouse metadata tree below. Experience how historical snapshots preserve time-travel, run bin-packing compaction (OPTIMIZE) to eliminate the small file problem, and test safe VACUUM policies:

Apache Iceberg / Delta Lake v3.2
Snapshot: v3 (2026-11-20 18:00:00)
OPTIMIZE (Bin-Packed)

Lakehouse ACID Snapshot & Compaction Engine

Explore immutable snapshot trees, execute time-travel queries across historical manifests, and simulate bin-packing compaction.

Active Parquet Files
2 files
Optimized 128MB files
Tombstoned Files
280 files
Retained for time-travel
S3 Query Planning Time
42 ms
Manifest list reading
ACID Transaction Log
Serializable
Optimistic Concurrency (OCC)
Apache Iceberg Metadata Tree Hierarchy
Iceberg Catalog
catalog.db.orders → points to latest metadata pointer:
v3.metadata.json
Manifest List
Snapshot ID: 849204829
Contains snapshot partition boundaries & manifests.
Manifest Files
Min/Max column stats for predicate pushdown:
id: [1000..95000]
Parquet Storage (S3)
2 Active Data Files
280 Tombstones (Historical)
Concept Check

What risk occurs if you execute VACUUM with a retention threshold of 0 hours on a production Lakehouse table?

4Bug Hunt: Optimize a Fragmented Lakehouse Table

The maintenance script below leaves 45,000 tiny files uncompacted, risks production downtime by executing a dangerous zero-hour vacuum, and performs unpartitioned table scans. Fix all three issues:

Lakehouse Engineering · Compaction & Transaction Safety
Python

🎯 Find and fix the bugs in the code above, then press Run & verify to test your solution.

Need a hint?
  • Call delta_table.optimize().executeCompaction() to bin-pack small files.
  • Replace vacuum(0) with safe 7-day retention vacuum(168).
  • Add time-travel options or partition filtering to the read query.

5Recap

  • Open Lakehouses (Apache Iceberg, Delta Lake) combine the low storage cost of cloud object storage with ACID database transactions.
  • Immutable Transaction Logs provide snapshot isolation, zero dirty reads under concurrent writes, and deterministic Time Travel queries.
  • Hidden Partitioning decouples user queries from physical S3 directory paths, allowing partition schemes to evolve without rewrites.
  • File Compaction (Bin-Packing) consolidates streaming micro-batch files into 128MB chunks, while VACUUM cleans up expired tombstones.

Ready for Chapter 11? Mark this chapter as complete to proceed:

Enjoying this free lesson? Your support helps us build more free animated chapters.

Support Us