how to dynamically explode array type column in pyspark or scala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2020 11:31 AM
HI,
i have a parquet file with complex column types with nested structs and arrays.
I am using the scrpit from below link to flatten my parquet file.
https://docs.microsoft.com/en-us/azure/synapse-analytics/how-to-analyze-complex-schema
I am able to flatten schema using script in STEP 1 and STEP 2 successfully. But in the above link, for STEP 3 the script uses hardcoded column names to flatten arrays. But in my case i have multiple columns of array type that need to be transformed so i cant use this method.
Is there any way to dynamically transform all the array type columns without hardcoding because in future the columns may change in my case. Something like check if a column is of array type and explode it dynamically and repeat for all columns of arrays.
Please advise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 12:39 PM
Hello, Please check out the below docs and notebook which has similar examples,
https://docs.microsoft.com/en-us/azure/synapse-analytics/how-to-analyze-complex-schema
