Incoming JSON events contain a nested address object with city and zip fields. A silver table needs city and zip as top-level columns for BI. Using PySpark, which operation correctly promotes the nested fields?
Answer & explanation
Correct answer: D
WHY D: Nested struct fields are accessed with dot notation (address.city); selecting and aliasing them promotes them to top-level columns.
WHY NOT A: explode is for arrays (and maps), not struct field access.
WHY NOT B: Regex parsing of a stringified struct is fragile and unnecessary when structured access exists.
WHY NOT C: Delta fully supports nested structs; they remain readable after the write.
WHY NOT E: pivot reshapes rows to columns by aggregation; it does not flatten a struct.