Data Ingestion and Transformation
A Spark job converts JSON orders containing arrays of line-item objects to Parquet. Downstream readers support nested Parquet fields and require one record per order with typed, queryable line items; which transformation BEST meets these requirements?
Show the answer
Correct answerB. Retain line items as an array of structs when writing
AWhy not this: Serialization preserves one order row but replaces typed nested fields with text that readers must parse.
BWhy this is right: An array of structs preserves item types and nesting while retaining one record per order.
CWhy not this: Normalization separates items from orders instead of retaining them within each order record.
DWhy not this: Exploding creates multiple rows for an order with multiple items, violating the required record shape.
Parquet supports nested arrays and structs, preserving typed line items within each order record. Exploding the array makes individual line items separate rows and breaks the required one-record-per-order shape.