I'm using the below code to write to a CSV file.
df.coalesce(1).write.format("com.databricks.spark.csv").option("header", "true").option("nullValue"," ").save("/home/user/test_table/")
when I execute it, I'm getting the following error:
java.lang.UnsupportedOperationException: CSV data source does not support null data type.
Could anyone please help?
df.printSchema()result?Nonetype as null object and did a save, it worked fine.df = sqlContext.createDataFrame([ (1.0, "Hi I heard about Spark"), (1.0, "Spark is awesome"), (0.0, None), (0.0, "And I don't know why...") ], ["label", "sentence"]) df.printSchema() df.coalesce(1).write.format("com.databricks.spark.csv")\ .option("header", "true")\ .option("nullValue"," ").save(drive+"/test.csv")