Wie speichere ich einen DataFrame als komprimierte (gezippte) CSV?

Ich benutze Spark 1.6.0 und Scala.

Ich möchte einen DataFrame als komprimiertes CSV-Format speichern.

Hier ist das, was ich bisher habe (nehme an, ich habe bereitsdf undsc wieSparkContext):

//set the conf to the codec I want
sc.getConf.set("spark.hadoop.mapred.output.compress", "true")
sc.getConf.set("spark.hadoop.mapred.output.compression.codec", "true")
sc.getConf.set("spark.hadoop.mapred.output.compression.codec", "org.apache.hadoop.io.compress.GzipCodec")
sc.getConf.set("spark.hadoop.mapred.output.compression.type", "BLOCK")

df.write
  .format("com.databricks.spark.csv")
  .save(my_directory)

Die Ausgabe ist nicht ingz Format

Antworten auf die Frage(8)

Ihre Antwort auf die Frage