-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
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.
|
There was a problem hiding this 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
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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. |
go/parquet/compress/compress.go
Outdated
// 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" |
There was a problem hiding this comment.
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?
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.
|
@zhouyan We squash when we merge anyways, so there's no need to manually do so yourself. |
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 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>
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>
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.