Hi @Daniel20, To flatten the sparkPlanInfo struct into an array of the same struct and then later explode it, you can follow these steps:
Flatten the Struct:
- Create a function that recursively traverses the schema of the sparkPlanInfo struct.
- For each field in the schema, if itโs of type StructType, recursively flatten it.
- Otherwise, add the field name to a list of flattened fields.
- The resulting list will contain all the flattened field names.
Explode the Array:
- Once you have the flattened field names, use the explode function to explode the array.
- Apply the explode function to each flattened field in the DataFrame.
Feel free to adapt this example to your specific Spark environment and requirements! ๐