QuestionQ45

VerifiedCost & Performance Optimisation

A data engineer is working in an interactive notebook with many transformations before displaying the result of display(df.collect()). The notebook contains wide transformations and a cross join.

The data engineer receives this error: “The spark driver has stopped unexpectedly and is restarting. Your notebook will be automatically reattached.”

Which action should the data engineer take?

Explanation

DataFrame.collect() returns every DataFrame record to the driver as a local list and should be used only when that result is small enough to fit in driver memory. A cross join and wide transformations can produce a large result, so collecting it can exhaust driver memory and restart the driver. The code should be changed to avoid placing that memory load on the driver.

Learn more

Community Discussion

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