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.
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
fix: BitPackedArray enforces can only be built over non-negative values #1705
fix: BitPackedArray enforces can only be built over non-negative values #1705
Changes from 4 commits
8ce7f04
e261638
7919506
5880b99
03a568a
3616dd9
c8d00bf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
API-wise, this feels iffy. There are probably other array types that can get some inputs that create weird states. WDYT about having a
try_new_unchecked
function + a checked function that does some similar validation to what we have here.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.
The thing that is annoying is that this function really shouldn't be
pub
but it has to be so that it's accessible from the sampling compressor.Otherwise users of the public API should be going through
BitPackedArray::encode
.My goal with the unsafe was to make it clear that there are invariants that users need to check themselves for the args they're passing to the function. I don't think we can check those invariants here without fully decompressing the packed buffer
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.
That makes sense. WDYT about just changing it to
unchecked
to keep the "convention" oftry_new
as something that errors safely everywhere else?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.
yea i can do that
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 is the alternative to doing
array.ptype().to_unsigned()
above. It'd be a bit less code and potentially less error-prone, I'm just not sure if we have/will ever have codepaths that assume that this exactly matches the DType