-
Notifications
You must be signed in to change notification settings - Fork 2
[ChunkCodecCore] BREAKING change the return type to MaybeSize
#72
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
Conversation
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.
Pull Request Overview
This PR implements a breaking change to the ChunkCodecCore library by introducing a new MaybeSize type to replace Union{Nothing, Int64} return types across all codec interfaces. The change improves error handling by allowing decoders to provide size hints when operations fail.
Key changes:
- Introduces
MaybeSizetype that can represent either a valid size (≥0) or failure with optional hints (<0) - Updates all codec interfaces to use
MaybeSizeinstead ofUnion{Nothing, Int64} - Modifies error handling to leverage size hints for better debugging
Reviewed Changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| ChunkCodecCore/src/errors.jl | Implements the new MaybeSize type and updates DecodedSizeError |
| ChunkCodecCore/src/interface.jl | Updates core codec interfaces to use MaybeSize |
| ChunkCodecCore/src/types.jl | Updates type documentation for new return types |
| ChunkCodecCore/src/noop.jl | Updates NoOp codec to use MaybeSize |
| ChunkCodecCore/src/shuffle.jl | Updates Shuffle codec to use MaybeSize |
| Various codec libraries | Updates all codec implementations across LibZstd, LibZlib, LibSnappy, LibLz4, LibBzip2, LibBrotli, LibBlosc, LibAec, and Bitshuffle |
| Test files | Updates tests to work with new MaybeSize type |
| Project.toml files | Version bumps and dependency updates for breaking change |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
===========================================
- Coverage 100.00% 95.11% -4.89%
===========================================
Files 2 38 +36
Lines 291 1902 +1611
===========================================
+ Hits 291 1809 +1518
- Misses 0 93 +93 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This PR changes the return type of
try_encode!,try_decode!, andtry_resize_decode!fromUnion{Nothing, Int64}to a newMaybeSizetype. This new type is a simple wrapper of anInt64where negative values represent not enough dst space, and positive or zero values represent regular integers.MaybeSizesupports converting to and fromInt64and will throwInexactErrorif a negative value is converted to anInt64, or a negativeInt64is converted to aMaybeSize.There is a added constant
NOT_SIZE = MaybeSize(typemin(Int64))Aside from
typemin(Int64), the other negative values can be used as a size hint, to improve error messages or performance.For example:
main: 4.907 ms (30 allocs: 36.358 MiB, 8.26% gc time)
PR: 2.359 ms (3 allocs: 16.000 MiB)