Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-40113: [Go][Parquet] New RegisterCodec function #40114

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Conversation

zhouyan
Copy link
Contributor

@zhouyan zhouyan commented Feb 18, 2024

This is to allow addition/overwrite of custom codec implementation

This allows other modules to provide alternative implementations for the compression algorithms, such as using libdeflate for Gzip, or CGO version of ZSTD.

In addition, it allows others to supply codecs that cannot be easily supported by this library such as LZO due to license reasons or LZ4.

Rationale for this change

See #40113

What changes are included in this PR?

A new RegisterCodec function added

Are these changes tested?

yes

Are there any user-facing changes?

It's an addition more targeted towards library writers.

… of custom codec implementation

This allows other modules to provide alternative implementations for the compression algorithms, such as using libdeflate for Gzip, or CGO version of ZSTD.

In addition, it allows others to supply codecs that cannot be easily supported by this library such as LZO due to license reasons or LZ4.
@zhouyan zhouyan requested a review from zeroshade as a code owner February 18, 2024 03:33
Copy link

⚠️ GitHub issue #40113 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

This looks good to me in general, just needs some comments for the documentation

go/parquet/compress/compress.go Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Feb 20, 2024
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Feb 20, 2024
@@ -92,6 +92,22 @@ type Codec interface {

var codecs = map[Compression]Codec{}

// RegisterCodec add new or override existing codec implementation for a given compression algorithm.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// RegisterCodec add new or override existing codec implementation for a given compression algorithm.
// RegisterCodec adds or overrides a codec implementation for a given compression algorithm.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Feb 20, 2024
Comment on lines 96 to 110
// The intended use case is within the init() section of a package. For example,
//
// // inside a custom codec package, say czstd
//
// func init() {
// RegisterCodec(compress.Codecs.Zstd, czstdCodec{})
// }
//
// type czstdCodec struct{} // implementing Codec interface using CGO based ZSTD wrapper
//
// And user of the custom codec can import the above package like below,
//
// package main
//
// import _ "package/path/to/czstd"
Copy link
Member

Choose a reason for hiding this comment

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

Can we fix the spacing?

@zhouyan
Copy link
Contributor Author

zhouyan commented Feb 20, 2024 via email

@zeroshade
Copy link
Member

@zhouyan We squash when we merge anyways, so there's no need to manually do so yourself.

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Feb 20, 2024
@zeroshade zeroshade changed the title GH-40113 [Go][Parquet] New RegisterCodec function GH-40113: [Go][Parquet] New RegisterCodec function Feb 20, 2024
@zeroshade zeroshade merged commit 47f15b0 into apache:main Feb 20, 2024
26 checks passed
@zeroshade zeroshade removed the awaiting change review Awaiting change review label Feb 20, 2024
@github-actions github-actions bot added the awaiting merge Awaiting merge label Feb 20, 2024
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 47f15b0.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Feb 28, 2024
This is to allow addition/overwrite of custom codec implementation

This allows other modules to provide alternative implementations for the compression algorithms, such as using libdeflate for Gzip, or CGO version of ZSTD.

In addition, it allows others to supply codecs that cannot be easily supported by this library such as LZO due to license reasons or LZ4.

### Rationale for this change

See apache#40113

### What changes are included in this PR?

A new RegisterCodec function added 

### Are these changes tested?

yes

### Are there any user-facing changes?

It's an addition more targeted towards library writers. 

* Closes: apache#40113

Authored-by: Yan Zhou <zhouyan@me.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
thisisnic pushed a commit to thisisnic/arrow that referenced this pull request Mar 8, 2024
This is to allow addition/overwrite of custom codec implementation

This allows other modules to provide alternative implementations for the compression algorithms, such as using libdeflate for Gzip, or CGO version of ZSTD.

In addition, it allows others to supply codecs that cannot be easily supported by this library such as LZO due to license reasons or LZ4.

### Rationale for this change

See apache#40113

### What changes are included in this PR?

A new RegisterCodec function added 

### Are these changes tested?

yes

### Are there any user-facing changes?

It's an addition more targeted towards library writers. 

* Closes: apache#40113

Authored-by: Yan Zhou <zhouyan@me.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Go][Parquet] Allow registering new codecs for parquet
2 participants