Spark DAG Scheduler: From Logical Plan to Physical Execution
When you submit a Spark job, the DAG scheduler translates the logical plan (chain of RDD transformations) into a physical execution plan:
- Build the DAG from the sequence of transformations
- Identify stage boundaries at shuffle points (wide dependencies like
groupByKey,reduceByKey) - Topologically sort stages to determine execution order
- Submit tasks for each stage’s partitions to the task scheduler
Stages within the same pipeline (connected by narrow dependencies) can fuse their transformations, avoiding intermediate materialization.