Error al explotar una columna de estructura en Spark
Tengo un marco de datos cuyo esquema se ve así:
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)
Estoy tratando de explotar elstruct
columnaproperties
usando el siguiente código:
df_json.withColumn("event_properties", explode($"event.properties"))
Pero está lanzando la siguiente excepción:
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),
Cómo explotar la columnaproperties
?