Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

add new codec option for compression in Spark-Tensorflow connector - #131

Merged
jhseu merged 2 commits into
tensorflow:masterfrom
vgod-dbx:tfrecord-gz
May 7, 2019
Merged

jhseu merged 2 commits into
tensorflow:masterfrom
vgod-dbx:tfrecord-gz

Conversation

@vgod-dbx

Copy link
Copy Markdown
Contributor

With #125, it became possible to output gzipped TFrecords by setting spark.hadoop.mapreduce.output.fileoutputformat.compress in the global SparkConf.
However, there's no way to only enable compression for individual DataFrame outputs.

This PR adds a new option codec to the Spark-Tensorflow connector for enabling compression in individual DataFrameWriter. With this, we don't need to set spark.hadoop.mapreduce.output.fileoutputformat.compress globally anymore.

Sample usage:

(
  dataframe
  .write
  .format('tfrecords')
  .option('codec', 'org.apache.hadoop.io.compress.GzipCodec')
  .save('sample.tfrecord.gz')
)

@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@vgod-dbx

Copy link
Copy Markdown
Contributor Author

I signed it!

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@jhseu

jhseu commented May 1, 2019

Copy link
Copy Markdown
Contributor

@skavulya Mind doing a code review?

@skavulya

skavulya commented May 2, 2019

Copy link
Copy Markdown
Contributor

@jhseu Sure, I'll review it. Thanks!

@skavulya

skavulya commented May 7, 2019

Copy link
Copy Markdown
Contributor

@vgod-dbx Thank you so much for the contribution. It looks good. Please add a description and example usage of the codec option to the README under the features section before merge.

@vgod-dbx

vgod-dbx commented May 7, 2019

Copy link
Copy Markdown
Contributor Author

@skavulya README updated! Thanks for the review.

@skavulya

skavulya commented May 7, 2019

Copy link
Copy Markdown
Contributor

@vgod-dbx Thanks! Looks great.
@jhseu The PR is ready for merge

@jhseu
jhseu merged commit 12d65f2 into tensorflow:master May 7, 2019
fjkfwz pushed a commit to xiachufang/ecosystem that referenced this pull request Oct 12, 2019
…ensorflow#131)

* support option 'codec' for compression

* add `codec` option to README
@eggie5

eggie5 commented Nov 14, 2019

Copy link
Copy Markdown

@vgod-dbx what version did this make it into? I'm on 1.13.1 and it seems to ignore the codec option...

@acastelli1

Copy link
Copy Markdown

Hi it seems that the codec is ignored actually

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants