Any candidate with a browser open can produce syntactically correct PySpark in about four seconds. That is the condition every interview now runs under, so the PySpark interview questions that still sort production-ready Databricks engineers from tutorial-level ones are no longer about syntax — they are about execution behaviour, cost and the judgment to debug a pipeline at 2am. 66% of developers now use coding assistants or coding agents, which means “writes a correct window function” has stopped being a signal. “Explains why that window function triggered a 400GB shuffle” has not.
What PySpark interview questions should you ask a data engineer?
Start with questions that have a wrong answer. Open-ended “tell me about your Spark experience” prompts reward fluency, not skill. Each question below has a factual core a candidate either knows from running jobs or does not.
| Question | Strong answer sounds like | Weak answer sounds like |
|---|---|---|
What’s the difference between repartition and coalesce? |
“repartition triggers a full shuffle and can increase or decrease partitions evenly; coalesce merges partitions without a shuffle, so it’s cheaper but can leave you with skewed partitions and reduced parallelism upstream.” |
“Both change the number of partitions. coalesce is the faster one.” |
| When does a DataFrame operation actually execute? | Names the action, explains lazy evaluation and that the Catalyst plan is built up until collect, write, count forces it — then mentions that this is why a job “fails at the write” when the bug is three transformations earlier. |
“Spark is lazy, it runs at the end.” |
| Why would you avoid a Python UDF? | Serialization cost crossing the JVM/Python boundary, loss of Catalyst optimisation, no predicate pushdown through it — then offers built-ins, pandas_udf with Arrow, or Spark SQL functions as the fix. |
“UDFs are slow.” |
| How do you handle a column that is 90% nulls in a join key? | Immediately names skew: null keys all hash to one partition, one task runs for an hour. Salting, filtering nulls out before the join, or a separate code path. | Suggests dropna() and moves on. |
What does cache() cost you? |
Memory pressure, eviction, the fact that it is itself lazy, and that caching a DataFrame read once is strictly a waste. | “Caching makes things faster so I cache the big tables.” |
The pattern: strong answers contain a trade-off. Weak answers contain an adjective.
How do you test PySpark coding skills in an interview?
Stop asking candidates to write code. Ask them to read it.
Give them a 40-line PySpark job with three deliberate problems — a collect() into a Python loop, a join with no broadcast hint against a 2MB dimension table, and a withColumn chain inside a for loop over 60 columns. Ask what they would change and in what order. You learn more in eight minutes than from any whiteboard exercise, and the answer cannot be pasted in because the job is yours.
The second technique is the physical plan. Show them df.explain() output and ask what it tells them. A candidate who has tuned real jobs reads SortMergeJoin, Exchange hashpartitioning and BroadcastHashJoin the way a mechanic reads an engine note. A candidate who has only built notebooks will narrate the words back to you.
If a candidate cannot read a physical plan, they cannot verify their own work — and verification is the whole job now.
That framing matters because developers themselves have landed on the same conclusion: only 6.6% say they would trust AI output for important decisions, and the rest trust it only when they can check it. Your interview should test the checking. The same reading test, one layer up, is what the dbt interview questions are for.
What PySpark questions suit a senior data engineer?
Seniority in Spark is mostly about failure. Mid-level engineers make jobs run; senior engineers make jobs run again after they break, without corrupting anything.
Idempotency. “Your daily job half-wrote yesterday’s partition before the cluster died. What happens when it reruns?” You are listening for overwrite-by-partition semantics, MERGE on a stable business key, Delta transaction atomicity, and an answer to the question of what downstream consumers saw in between. If they shrug at duplicate rows, that is your answer.
Schema evolution. “Upstream adds a nullable column on Tuesday and renames one on Wednesday. Which of those breaks you and why?” The additive change should be a non-event; the rename should trigger a conversation about contracts, not a mergeSchema reflex.
Backfills. “Reprocess three years of history on a cluster you also use for the daily load.” Partition-aware batching, cluster sizing, cost, and the blast radius on the live table — this question quietly tests whether they think about other people’s pipelines.
Data quality. 53% of data teams name poor data quality as a top challenge, so ask what they assert and where: expectations in the pipeline, row-count deltas, referential checks, and what they do when an assertion fails at 3am — quarantine, fail loudly, or write through and alert. There is a defensible answer for each, and no defensible answer for “we’d notice in the dashboard.”
If you are mapping these levels across a whole team rather than one hire, a Databricks skills matrix is a faster way to see where the gap actually sits. If the open seat is really a Spark engineer and a modeller fused together, split them first with Scala data engineer or dimensional modeller. For the schedule those jobs run on, use the Airflow interview questions. For the streams those jobs read, use the Kafka interview questions.
Which PySpark performance and optimization questions reveal real experience?
This is the section that separates the field, because performance knowledge comes almost exclusively from having been paged. Inefficient Spark jobs do not look like slow jobs on a finance report — they look like wasted cloud spend, which rose to 29% this year for the first time in five years as AI workloads surged.
Shuffles and partitioning
“Walk me through what happens physically during a wide transformation.” Expect: map-side write to local disk, partition by hash of the key, network fetch, and the fact that one slow task gates the whole stage. Then: “Your job has 200 output files of 4KB each. What went wrong?” — spark.sql.shuffle.partitions left at its default against a small result set, and the fix is partition tuning or compaction, not a bigger cluster.
Skew
“199 tasks finish in 30 seconds, one runs for 50 minutes.” If they go straight to “add executors,” stop. You want salting, isolating hot keys, skew join hints, or AQE’s skew handling — and ideally the diagnostic path through the Spark UI’s task duration distribution that got them there.
Broadcast joins
“When does a broadcast join hurt?” Driver memory limits, a dimension table that quietly grew past the auto-broadcast threshold, and broadcasting inside a loop. A candidate who only knows broadcast joins as a free speedup has not had one OOM the driver.
Caching
Ask when they would persist to disk rather than memory, and what unpersist() is for. Bonus signal if they mention that in a lakehouse with cheap columnar reads, re-reading is often cheaper than caching.
AQE
This is the single best senior filter in 2026. “What does adaptive query execution change at runtime, and what does it not fix?” Strong answers name coalescing shuffle partitions after the fact, switching sort-merge to broadcast once real sizes are known, and splitting skewed partitions. The published research on adaptive execution in lakehouses reports up to 25× per-query speedup on TPC-DS — an order of magnitude that a candidate who can’t explain runtime adaptivity is simply guessing at. Weak answers: “it’s on by default, it makes things faster.”
For teams on Delta specifically, pair these with Delta Lake and Iceberg table-format questions — optimisation on a lakehouse is half Spark behaviour and half file layout.
Should a PySpark interview include a take-home or live exercise?
A take-home tests whether someone can produce clean PySpark with unlimited time and tooling. That is now a near-universal yes, which makes it a poor filter and an expensive ask — four unpaid hours from a currently-employed senior engineer is how you lose your best candidates to the company that scheduled a 60-minute call instead.
| Format | What it actually tests | Candidate drop-off | Use it when |
|---|---|---|---|
| 4-hour take-home | Tooling access, patience | Highest | Almost never |
| Live code-from-scratch | Typing under pressure | High | You hire juniors |
| Code review of your broken job | Diagnostic reasoning, priorities | Low | Default screen |
| Physical plan / Spark UI walkthrough | Execution-model depth | Low | Senior and above |
| Incident retro from their own history | Ownership, organisation-specific judgment | Lowest | Final round |
That last row is the one most interviews skip, and it is the one Databricks’ own operational data argues for: reviewing 80,000 customer pipeline issues, over half required organisation-specific knowledge to triage and resolve. Generic Spark knowledge does not resolve most real incidents. Judgment inside a specific codebase does — so ask candidates to narrate one incident end to end: what alerted, what they checked first, what the actual cause was, and what they changed so it could not recur. Vague retros are the tell.
If you want the whole loop compressed, the 90-minute Databricks engineer vetting sequence is a workable template.
A scoring rubric that scales
With employment of data scientists projected to grow 34 percent from 2024 to 2034, you will be screening large pools for years. Unstructured interviews do not survive volume — scores drift between panellists and the loudest interviewer wins. Score each dimension 0–3 and set a floor rather than averaging, so a zero on execution model cannot be rescued by charisma.
| Dimension | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| Execution model | Thinks DataFrames are eager | Knows lazy/actions | Reads a physical plan | Predicts plan changes before running |
| Shuffle & skew | Unaware | Names the concept | Has fixed skew in production | Designs partitioning to avoid it |
| Cost awareness | Never mentions money | Mentions cluster size | Ties runtime to spend | Has cut a bill and can quantify it |
| Reliability | No idempotency story | Understands reruns | Has built MERGE-based recovery | Owns SLAs and data contracts |
| Debugging | Describes symptoms | Uses logs | Uses the Spark UI fluently | Walks a full incident to root cause |
| Communication | Jargon only | Explains to peers | Explains to analysts | Writes the postmortem others read |
A hire should clear 2 on execution model, shuffle/skew and debugging. Senior hires should hit 3 on at least two of those plus reliability.
Red flags
- Cluster-size-first thinking. Every performance answer ends in “more executors.”
- Never mentions the Spark UI. Someone who has tuned jobs has lived in the stages tab.
collect()in production code described without discomfort.- Caching as a reflex. Caches everything, unpersists nothing, cannot say what got evicted.
- No failure stories. Three years of Spark and nothing ever broke means either a very small job or a very selective memory.
- Cannot explain their own code. Paste-shaped answers that fall apart one follow-up deep — the most common new failure mode and the cheapest to detect: ask “why that and not the alternative?” twice.
- Pandas habits in disguise. Row-wise loops,
toPandas()on the main path, indexing assumptions that only hold on one machine.
Most of these surface in under ten minutes if you anchor the conversation to real jobs rather than abstractions. Keep the spec to what a Databricks engineer job description asks for before you score anyone against these flags. If you need the pool to screen against in the first place, that is what the data engineering network is for — anonymised, currently-employed Spark and Databricks specialists you can search without an account.
