HomeInterview QuestionsWhen you execute this notebook, how many stages wi…

When you execute this notebook, how many stages will be created in the backend?

🟡 Medium Conceptual Mid level
25Times asked
Aug 2026Last seen
Aug 2026First seen

💡 Model Answer

In Spark, a stage is a set of tasks that can run in parallel without shuffling data. The number of stages depends on the number of shuffle boundaries in the DAG. For a notebook that performs two transformations followed by an action, you typically get two stages: one for the transformations (no shuffle) and one for the action (which may trigger a shuffle if a reduceByKey or join is involved). If the notebook contains multiple actions or multiple shuffle operations, each shuffle introduces a new stage. Therefore, the exact count is determined by the logical plan, but you can inspect it with the Spark UI or the explain() method.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500