Transformations vs Actions

Here is the thing that catches everyone coming from SQL. When you write df.filter(...).groupBy(...).agg(...), nothing runs. Spark does not read a single row. You have only described work. The description is called a transformation, and transformations are lazy: each one adds a step to a plan and returns immediately, having done no computation at all. You can chain twenty of them and the cluster stays idle the entire time. The data actually moves only when you call an action. This is not a quirk to work around; it is the mechanism that lets Spark be fast, and understanding it is the difference between predicting a job's behaviour and being baffled by it. In SQL there is no gap between describing and executing: you send a statement, it runs, rows come back, all in one breath. Spark deliberat

About This Interactive Section

This section is part of the How a Spark Job Runs lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live PostgreSQL database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.

How DataDriven Lessons Work

DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.