Question: how dag works in spark?
Answer: At high level, when any action is called on the RDD, Spark creates the DAG and submits it to the DAG scheduler. The DAG scheduler divides operators into stages of tasks. A stage is comprised of tasks based on partitions of the input data. ... The final result of a DAG scheduler is a set of stages.