Skip to main content
Intermediatecomparison Verified ~7 min

What is a broadcast variable in Spark, and how is it different from a broadcast join?

Source: Spark cluster mode overview

Quick answerFree

A broadcast variable (sc.broadcast(value)) sends a read-only value, such as a lookup dictionary, to each executor once and keeps it there, instead of shipping it inside every task. A broadcast join is a SQL join strategy that copies a small DataFrame to every executor so the large side is not shuffled.

Detailed answer· ~310 words

Interview Prep

Unlock the full answer with Interview Prep

Get a ~310-word model answer, 5 key points, a visual explainer, 5 common mistakes and 5 follow-ups, plus 43 more Apache Spark questions.

Also in Pro (₹499 / 90 days).

Key points· 5 points

Interview Prep
Unlock with Interview Prep

Visual explainer· animated, step by step

Interview Prep
Unlock with Interview Prep

Common mistakes· 5

Interview Prep
Locked

Best practices· 4

Interview Prep
Locked

Likely follow-ups· 5 questions

Interview Prep
Unlock with Interview Prep

+ 43 more Apache Spark questions in Interview Prep, each with the full answer.

Discussion