Data Preparation for ML and AI

A Spark training pipeline reads all columns from a few very large S3 objects. The output must remain compressed while allowing multiple tasks to read different portions of each object; which layout should the engineer write?

Show the answer

Correct answerA. Parquet with Snappy compression

AWhy this is right: Parquet row groups support parallel reads even when their column chunks are compressed with Snappy.

BWhy not this: Gzip-compressed CSV is not splittable, limiting parallel reading within each large object.

CWhy not this: A gzip-compressed JSON array does not support independent parallel reads of portions of the object.

DWhy not this: Line-delimited records do not make a gzip-compressed object splittable.

Parquet allows Spark to process separate row groups in parallel while retaining compression. A single gzip-compressed text file is not splittable, so adding workers does not parallelize reading different portions of that file.