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:

  1. Build the DAG from the sequence of transformations
  2. Identify stage boundaries at shuffle points (wide dependencies like groupByKey, reduceByKey)
  3. Topologically sort stages to determine execution order
  4. 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.