Data Engineer Interview Question

One Spark task runs for an hour while the rest finish in seconds. What is happening and how do you fix it?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

That is data skew: one key holds a disproportionate share of the rows, so a single partition does most of the work after a shuffle. Confirm it by checking the distribution of the join or group key. Fix it by enabling adaptive query execution's skew join handling, broadcasting the small side if it fits, salting the hot key across multiple partitions, or filtering and processing the outlier keys separately.

Why interviewers ask this

Skew is the most common Spark performance problem, and the diagnosis path shows whether you have actually read a Spark UI. Interviewers want you to confirm the skew with data rather than guess, and to know that increasing executors or memory does not help because the bottleneck is one partition, not total capacity.

How to structure your answer

  • Name skew and explain why one partition dominates after a shuffle.
  • Confirm it: check key distribution and stage task duration spread.
  • Rule out the non fix of just adding executors.
  • Give the fixes in order: broadcast, AQE skew join, salting, isolate the key.
  • Mention nulls as a frequent hidden culprit.

Example answer

Spoken example, first person

Long tail on one task almost always means skew: after the shuffle, one key landed in one partition and that partition has most of the rows. First I confirm it rather than assume, so a group by on the join key with a count, and a look at the stage in the Spark UI where the max task duration and shuffle read size dwarf the median. Throwing executors at it does nothing, because the work is not distributed. The fix depends on shape. If the other side of the join is small, broadcast it and skip the shuffle entirely. If it is genuinely large on both sides, adaptive query execution can split skewed partitions automatically, and beyond that I salt: append a random suffix to the hot key, replicate the small side across those salts, join, then aggregate. The one that catches people is nulls. We had a join key that was null for about 40% of rows, all of which hashed to one partition, and filtering nulls before the join fixed it outright.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How does adaptive query execution detect a skewed partition?
  • What is the risk of broadcasting a table that is too large?
  • How would you salt a join without changing the results?

Related data engineer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot