How to export data from Spark SQL to CSV

前端 未结 7 1256
迷失自我
迷失自我 2020-12-04 15:31

This command works with HiveQL:

insert overwrite directory \'/data/home.csv\' select * from testtable;

But with Spark SQL I\'m getting an e

7条回答
  •  鱼传尺愫
    2020-12-04 16:03

    The error message suggests this is not a supported feature in the query language. But you can save a DataFrame in any format as usual through the RDD interface (df.rdd.saveAsTextFile). Or you can check out https://github.com/databricks/spark-csv.

提交回复
热议问题