我有同样的问题。
看完这篇文章,我找到了答案!!!
您必须
PythonRDD像这样转换为Type:
>>> type(df)<class 'pyspark.sql.dataframe.Dataframe'>>>> type(df.rdd)<class 'pyspark.rdd.RDD'>>>> df.rdd.saveAsNewAPIHadoopFile(...) # Got the same error message>>> df.printSchema() # My schemaroot |-- id: string (nullable = true) ...# Let's convert to PythonRDD>>> python_rdd = df.map(lambda item: ('key', {... 'id': item['id'], ...... }))>>> python_rddPythonRDD[42] at RDD at PythonRDD.scala:43>>> python_rdd.saveAsNewAPIHadoopFile(...) # Now, success


