GH-40113: [Go][Parquet] New RegisterCodec function#40114
Merged
zeroshade merged 3 commits intoapache:mainfrom Feb 20, 2024
Merged
GH-40113: [Go][Parquet] New RegisterCodec function#40114zeroshade merged 3 commits intoapache:mainfrom
zeroshade merged 3 commits intoapache:mainfrom
Conversation
… 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.
|
|
zeroshade
requested changes
Feb 20, 2024
Member
zeroshade
left a comment
There was a problem hiding this comment.
This looks good to me in general, just needs some comments for the documentation
zeroshade
reviewed
Feb 20, 2024
go/parquet/compress/compress.go
Outdated
|
|
||
| var codecs = map[Compression]Codec{} | ||
|
|
||
| // RegisterCodec add new or override existing codec implementation for a given compression algorithm. |
Member
There was a problem hiding this comment.
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. |
zeroshade
reviewed
Feb 20, 2024
go/parquet/compress/compress.go
Outdated
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" |
Contributor
Author
|
Will do shortly. Shall I squash all the commits, so not to pollute the commit history?
… On 20 Feb 2024, at 23:55, Matt Topol ***@***.***> wrote:
@zeroshade commented on this pull request.
In go/parquet/compress/compress.go <#40114 (comment)>:
> +// 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"
Can we fix the spacing?
—
Reply to this email directly, view it on GitHub <#40114 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAEDP2KOW4AXYCVOIS47GHLYUTBP5AVCNFSM6AAAAABDN2BGESVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQOJQHAZDANBZGY>.
You are receiving this because you authored the thread.
|
Member
|
@zhouyan We squash when we merge anyways, so there's no need to manually do so yourself. |
zeroshade
approved these changes
Feb 20, 2024
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.