Your project story
| Part | What to say (from this course) |
|---|---|
| Ingestion | Read daily order CSVs with an explicit schema; PERMISSIVE mode isolated a malformed row instead of crashing |
| Transformation | Cleaned and enriched with column expressions; joins with customers/products; window functions for latest-record de-duplication and rankings |
| Storage | Partitioned Parquet by date, then Delta with MERGE upserts, time travel and OPTIMIZE |
| Streaming | Incremental file stream with checkpoints and availableNow; foreachBatch + MERGE for upserts |
| Performance | AQE, broadcast joins, caching reused data, salting a skewed key |
| Quality | pytest + assertDataFrameEqual caught cancelled orders inflating revenue |
Questions by topic
π― Architecture and DataFrames
Try to answer out loud first, then tap to check.
Q1Explain Spark's architecture.Fresher+
Q2Transformations vs actions?Fresher+
Q3Narrow vs wide transformations?Fresher+
Q4Why define schemas instead of inferSchema?1β3 yrs+
Q5How do you handle corrupt records?1β3 yrs+
Q6DataFrame vs RDD?1β3 yrs+
Joins and windows: lesson 3, lesson 4, SQL/UDFs: lesson 5.
π― Joins, windows, SQL and UDFs
Try to answer out loud first, then tap to check.
Q1Name the join types.Fresher+
Q2What is a broadcast join?1β3 yrs+
Q3row_number vs rank vs dense_rank?1β3 yrs+
Q4Why are Python UDFs slow?1β3 yrs+
Q5A join returns far more rows than expected. Why?3+ yrs+
Performance: lesson 6.
π― Performance
Try to answer out loud first, then tap to check.
Q1repartition vs coalesce?1β3 yrs+
Q2What does AQE do?1β3 yrs+
Q3When do you cache?1β3 yrs+
Q4How do you fix data skew?3+ yrs+
Q5Too many small output files. Fix?3+ yrs+
Delta, streaming, testing: lesson 7, lesson 8, lesson 9.
π― Delta, streaming and testing
Try to answer out loud first, then tap to check.
Q1How do you upsert into Delta from PySpark?1β3 yrs+
Q2What is a checkpoint in Structured Streaming?1β3 yrs+
Q3What is a watermark?1β3 yrs+
Q4How do you unit test PySpark?1β3 yrs+
Q5How do you upsert a stream into a table?3+ yrs+
Coding patterns to know by heart
from pyspark.sql import Window, functions as F
w = Window.partitionBy("order_id").orderBy(F.desc("updated_at"))
latest = (df.withColumn("rn", F.row_number().over(w))
.filter("rn = 1").drop("rn"))w = Window.partitionBy("city").orderBy(F.desc("revenue"))
top2 = df.withColumn("rank", F.dense_rank().over(w)).filter("rank <= 2")w = Window.partitionBy("customer_id").orderBy("order_date") \
.rowsBetween(Window.unboundedPreceding, 0)
df = df.withColumn("running_total", F.sum("amount").over(w))never_ordered = customers.join(orders, "customer_id", "left_anti")items = events.select("event_id", F.explode("items").alias("item")) \
.select("event_id", "item.product_id", "item.qty")Each one ran in this course: patterns 1β3 in lesson 4, pattern 4 in lesson 3, and the JSON structure in lesson 2.
Scenario questions (3 years experience)
π― Real-world scenarios
Try to answer out loud first, then tap to check.
Q1A daily job that took 10 minutes now takes 2 hours. How do you investigate?3+ yrs+
Q2Duplicates appear in the target after a job retry.3+ yrs+
Q3An OOM error on the driver.3+ yrs+
Key takeaways
- βExplain with examples you ran: real numbers persuade interviewers.
- βFive coding patterns cover most live PySpark questions.
- βPerformance answers start with the Spark UI, not guesses.
- βIdempotent writes and tests show production experience.
Frequently asked questions
How should I prepare for a PySpark interview?
Be able to explain the driver/executor model, lazy evaluation, narrow vs wide transformations and shuffles, joins (including broadcast), window functions, partitioning and skew, caching, Delta and streaming basics. Practise the five coding patterns on this page until you can write them from memory.
Is PySpark coding asked live?
Usually yes: de-duplicate keeping the latest record, top N per group, running totals, anti joins, exploding arrays, and fixing a slow job. Interviewers also ask you to read a plan (explain) or a Spark UI screenshot.
π§ Quick check: PySpark interview
1. Keep the latest record per key?
2. Customers without orders?
3. One task runs 10Γ longer than others. Likely...
Checking your accessβ¦