An AWS Glue Spark batch job reads millions of small JSON files from Amazon S3 with a Spark DataFrame (spark.read.json), and the driver runs out of memory while tracking the file tasks. Which change most directly reduces this overhead?
Show the answer
Correct answerC. Read the files through a DynamicFrame with groupFiles set to inPartition.
AWhy not this: Bookmarks track processing progress; they do not reduce file-task overhead for files that must be read.
BWhy not this: Crawler frequency affects metadata discovery, not the number of tasks used to process input files.
CWhy this is right: A DynamicFrame read that groups files within partitions creates far fewer input tasks, reducing driver overhead.
DWhy not this: Recursive reading includes nested paths; it does not consolidate small files into fewer tasks.
A plain Spark DataFrame read creates a task for each small file, and the driver must track them all. Reading through an AWS Glue DynamicFrame with groupFiles set to inPartition combines small files within each S3 partition into groups, so far fewer tasks are created; for DynamicFrame reads, AWS Glue turns grouping on automatically when there are more than 50,000 input files. Job bookmarks track previously processed data but do not group files within a batch.