InterviewStack.io LogoInterviewStack.io

Distributed Data Processing with Spark and Hadoop Questions

Distributed compute engines for large-scale data processing, with Apache Spark as the primary focus: driver/executor architecture, the RDD/DataFrame/Dataset APIs, lazy evaluation and the Catalyst/Tungsten optimizers, shuffle and partitioning, data skew detection and mitigation (salting, broadcast joins, adaptive query execution), memory tuning, and caching/persistence strategies. Covers engine-internal execution and recovery within a single job: how the DAG scheduler breaks work into stages and tasks, task retries, speculative execution, stage recomputation from RDD lineage, and Structured Streaming's own checkpointing and write-ahead logs for exactly-once semantics. Also covers the Hadoop ecosystem as historical foundation (HDFS, MapReduce, YARN, Hive) and modern lakehouse table formats (Delta Lake, Iceberg) that have largely replaced it in current interview practice. The distributed-processing depth expected of data engineers at scale: writing and tuning jobs, diagnosing OOMs and skew, and choosing the right engine, storage format, and cluster configuration for a workload. Distinct from workflow-orchestration-and-scheduling, which owns the external, Airflow-style scheduler that invokes jobs like these as steps in a larger multi-system pipeline, and from data-reliability-and-fault-tolerance, which owns designing idempotent, cross-system pipeline behavior around job failures rather than the engine's own internal recovery mechanics.

MediumTechnical
60 practiced

Implement a map-side join in PySpark given the following schemas: large_df(user_id string, event_time timestamp, value double) with billions of rows and small_lookup(id string, country string, iso_code string) with a few million rows that fit in memory. Write a PySpark function that broadcasts the small lookup and performs the join without collecting the large dataframe to the driver. Use DataFrame APIs in Python and explain assumptions about memory and thresholds.

MediumTechnical
62 practiced

A production Spark job shows many straggler tasks: most tasks complete quickly but a few take 10x longer. Describe the steps you would take using the Spark UI and logs to identify whether the cause is data skew, GC, IO, network, or resource starving, and list three concrete mitigations for each possible root cause.

EasyTechnical
75 practiced

Explain the MapReduce computation pattern and how it maps to Spark RDD and DataFrame operations. Use the classical word-count example and indicate which Spark transformations/actions correspond to map, combine and reduce. Discuss scenarios where MapReduce semantics are insufficient and how Spark's DAG, in-memory caching, and DataFrame optimizations extend the model.

MediumTechnical
67 practiced

Describe the main join strategies Spark may choose: broadcast-hash-join, shuffle-hash-join, and sort-merge-join. For a join between a 200M-row 'events' table and a 50k-row 'countries' lookup table, which strategy will Spark likely pick and why? Explain how to inspect and influence the planner (EXPLAIN, hints, configuration).

MediumTechnical
62 practiced

In PySpark (Python), write code using the DataFrame API to compute the top-5 most frequent item_id values per user_id from a DataFrame events(user_id string, item_id string). The solution must avoid collecting all data to the driver, handle large cardinality, and use window functions or aggregations. Assume DataFrame is named 'events'.

Unlock Full Question Bank

Get access to all Distributed Data Processing with Spark and Hadoop interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.