Skip to content

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

Merged
zeroshade merged 3 commits intoapache:mainfrom
zhouyan:main
Feb 20, 2024
Merged

GH-40113: [Go][Parquet] New RegisterCodec function#40114
zeroshade merged 3 commits intoapache:mainfrom
zhouyan:main

Conversation

@zhouyan
Copy link
Copy Markdown
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
@github-actions
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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

@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

var codecs = map[Compression]Codec{}

// RegisterCodec add new or override existing codec implementation for a given compression algorithm.
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.

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
Copy Markdown
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
Copy Markdown
Contributor Author

zhouyan commented Feb 20, 2024 via email

@zeroshade
Copy link
Copy Markdown
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
@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
@conbench-apache-arrow
Copy link
Copy Markdown

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.

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