QuestionQ5

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A data engineer is developing a Spark application containing two DataFrames:

  • DataFrame A holds detailed transaction records from the last year and is 128 GB in size.
  • DataFrame B holds a lookup table of user details and is 1 GB in size.

For performance optimization, the developer chooses to use a broadcast join.

Which approach should the engineer use to choose the DataFrame to broadcast?

Explanation

A broadcast join distributes the smaller build-side DataFrame to executors, so the large transaction DataFrame can be joined without being shuffled across the cluster. Broadcasting the 1 GB lookup DataFrame therefore avoids shuffling the 128 GB DataFrame. Spark documents that a broadcast hint makes the hinted relation the broadcast join build side.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!