About CodeForData
CodeForData is a practice site for the questions asked in data engineering interviews, with problems in PySpark, Spark SQL, dbt and Airflow and in-depth lessons to go with them. Each problem describes the result you need and checks your code against a sample and against hidden tests built around the cases that catch people out, such as nulls, ties, duplicate keys and failed runs.
How it works
- Run executes your code instantly in a PySpark DataFrame emulator inside your browser, against the sample data shown on the page. There is nothing to install and no cluster to wait for.
- Submit grades your code on our server against every test case, including the hidden ones. Once you pass, the reference solution unlocks with an explanation of why it works.
- dbt problems are compiled the way dbt compiles them and run in DuckDB on our server, against a sample on Run and every test on Submit, including incremental runs against an existing table.
- Airflow problems are real Airflow 3 DAG files. They run in a simulation of the scheduler, and what happens is graded run by run: which runs are created, and each task's state and tries, on hidden scenarios with failures.
- You can practise without an account. Logging in keeps your solved problems, code and submissions in sync across devices.
What you can practise
PySpark: filtering and selection, conditional logic, null handling, aggregations, strings, dates, joins, arrays, window functions, pivot, unpivot and rollup, from easy warm-ups to senior-level patterns such as sessionization, gaps and islands and SCD Type 2. Also Spark performance (join strategies, skew and salting), data lake (partition layout, small files, compaction, late data) and lakehouse (Delta transaction logs, VACUUM, change data feeds, MERGE and CDC, Iceberg partitioning).
dbt: sources and staging models, refs and marts, Jinja, vars and target, macros, data tests and incremental models.
Airflow: schedules, catchup and backfill, templates, retries, trigger rules, branching, XCom, task groups, and keeping days in order under concurrency limits.
Practise PySpark problems (listed by topic, from Bronze to Gold), dbt problems or Airflow problems.
The lessons
The lessons run from Bronze (core concepts) to Gold (deep internals), with runnable examples and practice problems along the way. A core path covers PySpark functions, Spark internals, the data lake and lakehouse and Structured Streaming. Two more tracks cover running pipelines in production: dbt and Airflow.
The emulator
The emulator implements a subset of the PySpark DataFrame API (the everyday functions interviews focus on) and runs in your browser. It is not Apache Spark: nothing runs on a cluster, so it cannot measure how long a query takes or how many bytes it shuffles.
That is why the Spark performance, data lake and lakehouse problems work on metadata as DataFrames: file listings with paths and sizes, Delta transaction log entries, table sizes and join lists, key distributions, change feeds and query date ranges. Your code makes the decision a data engineer would make from that metadata (which files to compact, which join strategy Spark picks, which files VACUUM may delete, which partitions a query reads), and it is graded like any other problem.
The Airflow simulator works the same way: it is not Apache Airflow, so nothing runs for real and times are simulated. It covers the scheduling, retry and dependency behaviour the problems need, and every reference solution is checked against real Airflow.
Apache Spark, PySpark and Apache Airflow are trademarks of the Apache Software Foundation, and dbt is a trademark of dbt Labs. CodeForData is not affiliated with them.
Who runs it
CodeForData is an independent project operated by Suraj Anand in India. Questions, corrections and feedback are welcome on the Contact page.