Data Operations and Support

An AWS Glue Spark job fails with driver out-of-memory errors when collect() retrieves a large DataFrame for writing to S3. Which change best addresses the cause?

Show the answer

Correct answerC. Write the DataFrame directly with Spark.

AWhy not this: collect() still brings all records to the driver, regardless of the number of source partitions.

BWhy not this: Retries repeat the same memory-intensive operation without changing its memory requirements.

CWhy this is right: A distributed write lets executors write the data without gathering the entire DataFrame on the driver.

DWhy not this: Log retention affects how long diagnostic records remain available, not driver memory consumption.

A distributed Spark write avoids collecting the entire dataset into driver memory. Repartitioning to one partition does not make collect() safe because it still returns all records to the driver.