【发布时间】:2021-10-31 05:28:56
【问题描述】:
我在工作,我需要立即帮助 我有一个镶木地板文件,我需要将其转换为 csv。你能帮帮我吗?
错误:
AnalysisException: CSV data source does not support array<struct<company:string,dateRange:string,description:string,location:string,title:string>> data type.
我从未使用过这种格式,所以我什至无法打印架构。对不起
printshema:
root
|-- _id: string (nullable = true)
|-- Locale: string (nullable = true)
|-- workExperience: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- company: string (nullable = true)
| | |-- dateRange: string (nullable = true)
| | |-- description: string (nullable = true)
| | |-- location: string (nullable = true)
| | |-- title: string (nullable = true)
【问题讨论】:
-
看起来 parquet 文件有一个包含结构对象数组的列。由于 csv 是一种简单的文本格式,它不支持这些复杂的类型。您应该提供 parquet 文件 (
spark.read().parquet(...).printSchema()) 的架构和一些示例数据以及 csv 格式的预期输出。 -
@werner 我打印了架构
标签: apache-spark pyspark parquet