I have a dataframe whose schema looks like this:
event: struct (nullable = true)
| | event_category: string (nullable = true)
| | event_name: string (nullable = true)
| | properties: struct (nullable = true)
| | | ErrorCode: string (nullable = true)
| | | ErrorDescription: string (nullable = true)
I am trying to explode the struct
column properties
using the following code:
df_json.withColumn("event_properties", explode($"event.properties"))
But it is throwing the following exception:
cannot resolve 'explode(`event`.`properties`)' due to data type mismatch: input to function explode should be array or map type, not StructType(StructField(IDFA,StringType,true),
How to explode the column properties
?