Reviewed by Aditya Kumar · Last reviewed 2026-03-25
**Map**: 1:1 transformation. Each input produces one output. Narrow dependency—no shuffle. Examples: `map`, `filter`, `flatMap`. **Reduce**: N:1 aggregation. Combines elements; may require shuffle for global aggregation. Wide dependency. Examples: `reduce`, `reduceByKey`,...
Map: 1:1 transformation. Each input produces one output. Narrow dependency—no shuffle. Examples: map, filter, flatMap.
Reduce: N:1 aggregation. Combines elements; may require shuffle for global aggregation. Wide dependency. Examples: reduce, reduceByKey, aggregate.
Why reduceByKey > groupByKey: reduceByKey does map-side combine first; less data shuffled. groupByKey shuffles all values.
Scalability Trade-offs: Map scales linearly with partitions. Reduce bottlenecked by shuffle; skew in reduceByKey causes stragglers.
Cost Implications: Reduce is expensive—network and serialization. Minimize reduce scope; use map-side combiner when possible.
Pro-Move: 'reduceByKey + mapPartitions for two-phase agg on skewed keys.' Red Flag: groupByKey when reduceByKey works—10x more shuffle.
According to DataEngPrep.tech, this is one of the most frequently asked Spark/Big Data interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.