【发布时间】:2018-06-27 04:19:22
【问题描述】:
我有一个数据框,其架构如下所示:
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)
我正在尝试使用以下代码分解struct 列properties:
df_json.withColumn("event_properties", explode($"event.properties"))
但它抛出了以下异常:
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),
如何爆列properties?
【问题讨论】:
-
@user8371915 由于该问题已被标记为该问题的重复,您的近距离投票现在将导致循环重复导航(如果现在尝试则无效)
标签: scala apache-spark pyspark apache-spark-sql spark-dataframe