All Spark labs

How Spark plans your code Work in progress

This lab is still in development and is not yet complete. Features, lessons and animations may change.

Interactive planning lab

Write code and follow the plan

Build a small program, then watch the driver plan it and executor tasks read their input partitions.

This is an educational simulation. DuckDB verifies the result on eight sessions from the ticketing database. The source preview is teaching data, not the driver’s collected result.

Your small program

Use event_sessions, an optional numeric capacity filter, then select(...) or groupBy("event_id").agg(F.sum("capacity").alias(...)). collect() requests the result. Other Python is not executed. Changing the code starts a fresh walkthrough.

Choose an example, then explain the plan. No simulated job has started.

Connect the animation to Spark Pills

Pill 2 · Lazy evaluation and DAG Pill 3 · The shuffle Explore the complete series
Model assumptions and sources

These are simplified Spark 3.5-style batch scenarios with AQE disabled, no pre-existing key partitioning, no cache, no retries and no modeled spills. The planning lab arranges eight source rows into four teaching partitions. The playground assigns source partitions round-robin. Shuffle uses an illustrative hash, not Spark’s hash. Task slots assume one CPU per task. Animation ticks are not timings or performance predictions.

A grouped sum/count uses partial aggregation before exchange and final aggregation after exchange. The narrow select scenario has no exchange. Real physical plans, stage counts, partitioning and task placement depend on configuration, data sources, optimizations and runtime statistics. Loading the DuckDB sample is lab setup; it does not demonstrate a Spark read or measure Spark I/O.

Tasks execute work. Data blocks, rather than tasks, may be stored. Shuffle files, cached partitions and memory spills are distinct; these scenarios model shuffle outputs only.

References: Spark cluster overview, shuffle operations, adaptive query execution.