The nested schema can be struct of struct or array of struct or more complex and we are given a column name to drop from the dataframe.
|-- details: array
| |-- element: struct
| | |-- source_id: string
| | |-- destination_id: string
| | |-- items: array
| | | |-- element: struct
| | | | |-- data: array
| | | | | |-- element: struct
| | | | | | |-- amount: integer
| | | | | | |-- percent: double
| | | | |-- id: string
| | | | |-- period: struct
| | | | | |-- end: long
| | | | | |-- start: long
The schema is like this and the list contains [details.items.element.amount]. I want to automate the process of dropping columns from the list and the data inside dataframe should be kept.