Skip to content

[BEAM-6365] Add ZStandard compression support for Java SDK - #7416

Closed
jklukas wants to merge 1 commit into
apache:masterfrom
jklukas:add-zstd
Closed

jklukas wants to merge 1 commit into
apache:masterfrom
jklukas:add-zstd

Conversation

@jklukas

@jklukas jklukas commented Jan 4, 2019

Copy link
Copy Markdown
Contributor

Adds a dependency on zstd-jni which declares no transitive dependencies,
but otherwise just fills out enum values to expose the ZStandard support
that already exists in commons-compress.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

It will help us expedite review of your Pull Request if you tag someone (e.g. @username) to look at it.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status Build Status Build Status Build Status Build Status
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

Adds a dependency on `zstd-jni` which declares no transitive dependencies,
but otherwise just fills out enum values to expose the ZStandard support
that already exists in commons-compress.
@jklukas

jklukas commented Jan 4, 2019

Copy link
Copy Markdown
Contributor Author

cc @jkff who originally merged Compression.java.

@jklukas

jklukas commented Jan 4, 2019

Copy link
Copy Markdown
Contributor Author

Run Python PreCommit

@iemejia iemejia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Awesome, super clean implementation nothing to say 👏

/** @see Compression#ZSTD */
ZSTD(Compression.ZSTD),

/** @see Compression#DEFLATE */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

}

/** Test reading according to filepattern when the file is gzipped. */
/** Test reading according to filepattern when the file is bzipped. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other good catch good.

@iemejia

iemejia commented Jan 9, 2019

Copy link
Copy Markdown
Member

This adds a new dep for sdks/java/core. It is a pity that we don't have an extensible mechanism for new compression schemas. Has somebody proposed or discussed this @kennknowles? As usual I am afraid of possible conflict on dependencies.

@iemejia

iemejia commented Jan 9, 2019

Copy link
Copy Markdown
Member

I will wait for the extra comment but probably will merge it ASAP. Thanks @jklukas !

@jklukas

jklukas commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

We could move zstd-jni to a test dependency and document that users will need to add that dependency on their own. If the lib isn't present, you'll see runtime errors about a class not being found. We could catch that error and output a message that users are expected to provide zstd-jni.

@iemejia

iemejia commented Jan 10, 2019

Copy link
Copy Markdown
Member

I think that the test idea brings a bit too much complexity. I was thinking more about having something like a Registrar like we do for FileSystems or other service like extensible parts.

@iemejia

iemejia commented Jan 11, 2019

Copy link
Copy Markdown
Member

Any comment on this one @kennknowles WDYT do we take the extension like approach or we merge as it is? Notice that zstd jar dep uses also JNI.

@kennknowles

Copy link
Copy Markdown
Member

Is it marked experimental? I think most new features should be, for a while. It might be hard to mark the right pieces of code, given how this fits in, but still seems a good idea.

With that, I think as-is is fine. The implementation and tests are consistent with what we already have. I do think moving to an extension model would be a good improvement, and we can probably do it to all the pieces of the enum at the same time and this will not make it much harder.

@iemejia

iemejia commented Jan 14, 2019

Copy link
Copy Markdown
Member

@jklukas I created BEAM-6422 to create an extensible mechanism for compression. I will tackle this during the week and ping you when ready so you can rebase and add zstd as the first use case of it.
Sorry for the delay/inconvenience but it is just to have a leaner core.

@jklukas

jklukas commented Jan 14, 2019

Copy link
Copy Markdown
Contributor Author

I will tackle this during the week and ping you when ready so you can rebase and add zstd as the first use case of it

That sounds great.

@iemejia

iemejia commented Feb 8, 2019

Copy link
Copy Markdown
Member

@jklukas I have been considering this PR since it does not add a compile time dependency (it 'only' depends on commons-compress) that we should better rely on commons-compress as in the middle mechanism, and make zstd-jni optional at some moment if we find clashes with other versions. So I am going to merge this one.
Thanks a lot for implementing this and sorry if the discussion made the merge take longer.

@iemejia iemejia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will do some minor adjustments and merge manually.

iemejia added a commit that referenced this pull request Feb 8, 2019
@iemejia

iemejia commented Feb 8, 2019

Copy link
Copy Markdown
Member

Merged !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants