HomeInterview QuestionsWhy are wide transformations costly?

Why are wide transformations costly?

🟡 Medium Conceptual Mid level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

In Apache Spark, wide transformations such as groupBy, reduceByKey, join, and distinct require a shuffle phase. During a shuffle, data is redistributed across the cluster based on a key, which involves writing intermediate data to disk, network transfer, and sorting. These operations are expensive because they incur I/O, serialization/deserialization, and network latency. Additionally, wide transformations can lead to data skew if a few keys dominate, causing some tasks to process far more data than others, further increasing runtime. In contrast, narrow transformations (e.g., map, filter, flatMap) can be executed locally on each partition without shuffling, making them much faster. Therefore, wide transformations are costly due to the overhead of shuffling, disk I/O, and potential data skew, which can significantly impact job performance.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500