【发布时间】:2020-05-27 20:12:20
【问题描述】:
我正在尝试将数据框结果写入文本文件,但出现以下错误,我不明白数据类型到底出了什么问题
这是我的数据框结果
我正在使用下面的代码将结果写入文本文件
User_cast.write.mode("overwrite").option("compression","bzip2").format("text").save("loc/path")
遇到错误
pyspark.sql.utils.AnalysisException: u'Text data source does not support double data type.;'
【问题讨论】:
-
也许如果你执行
User_cast.printSchema()问题会变得更清楚? -
感谢@mazaneicha,我执行了 User_cast.printSchema() 并且架构定义如下 |-- id: string (nullable = true) |-- name: string (nullable = true) |--薪水:双倍(可为空=真)
标签: apache-spark pyspark apache-spark-sql pyspark-dataframes