Skip to content

Instantly share code, notes, and snippets.

@dokipen
Created June 10, 2015 15:04
Show Gist options
  • Select an option

  • Save dokipen/aa07f351a970fe54fcff to your computer and use it in GitHub Desktop.

Select an option

Save dokipen/aa07f351a970fe54fcff to your computer and use it in GitHub Desktop.
lines.repartition(1).foreachRDD((rdd: RDD[_], time: Time) => {
val file = backupPath + "-" + time.milliseconds
if ("".equals(compressionCodec)) {
rdd.saveAsTextFile(file)
} else {
val codec = Class.forName(compressionCodec).asInstanceOf[Class[_ <: org.apache.hadoop.io.compress.CompressionCodec]]
rdd.saveAsTextFile(file, codec)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment