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
feat: better ways to use deletion vectors #215
feat: better ways to use deletion vectors #215
Changes from 8 commits
9cd41f2
9edcce9
6acb5f8
6c726f5
0c20f6b
213c519
0da2dfb
ea36d70
1c897c6
b33d621
c621634
4b8e18f
63bdbc6
b92fcc0
bfc7486
59c150b
8e19022
265d1f1
90dc89f
c97c456
e68dc95
c9e08f2
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.
is this accurate?
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.
update: this mirrors the existing
KernelBoolSlice
, which uses a null pointer to represent the empty slice.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.
However, according to std::slice::from_raw_parts:
... that way, we wouldn't need any null check in the
as_ref()
method below.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 docs for
Vec
don't specifically mentionNonNull::dangling
, but Vec::as_ptr does returnThe docs for Vec::from_raw_slice are not clear tho:
Further, both Unique::dangling and NonNull::dangling state that they are
That said, it's probably safest of all to just use
Vec::new().as_mut_ptr()
as pointer for an empty index slice.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.
However, the null pointer approach is simpler if the engine might ever need to create one of these to pass into kernel? Actually, given how messy all the non-null/unique/etc constraints are, nullable pointers are probably the simplest even if engine doesn't need to create one.
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.
Sorry it's not clear to me what changes should be made? Should be switch both slice types over to a new way in a subsequent PR?
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.
Yeah sorry that was a lot of rambling/exploring. Basically, we have two options for representing an empty slice:
Rust and its library classes don't have a really nice way to handle either case, so IMO we should choose the least-bad approach (= least code and least error prone) and use that consistently. Maybe the current code is already the correct choice.
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.
Actually, the current code does both -- the slice -> vec code assumes nullable pointer, while the vec -> slice (
impl From
) uses a dangling pointer. We should pick one and stick with it.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.
Any opinion on which you prefer @scovich ? I'd probably go with the always non-null length zero.
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.
I updated both bool and row id slice to use non-zero length as empty.