-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore: use new OffsetBuffer::subtract helper
#23424
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1236,16 +1236,7 @@ pub fn adjust_offsets_for_slice<O: OffsetSizeTrait>( | |
| ) -> OffsetBuffer<O> { | ||
| let offsets = list.offsets(); | ||
|
|
||
| if let (Some(first), Some(last)) = (offsets.first(), offsets.last()) | ||
| && (!first.is_zero() || last.as_usize() != list.values().len()) | ||
| { | ||
| let offsets = offsets.iter().map(|offset| *offset - *first).collect(); | ||
|
|
||
| //todo: use unsafe Offset::new_unchecked? | ||
| return OffsetBuffer::new(offsets); | ||
| } | ||
|
|
||
| offsets.clone() | ||
| offsets.clone().subtract(offsets[0]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a prefix slice where the first offset is zero but the last visible offset is before the end of the original child values,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'm willing to sacrifice that in favor of avoiding copy and because this was not guaranteed |
||
| } | ||
|
|
||
| /// For lists and large lists, truncates the sublist of null values | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Even though this code has
last != list.values().len()and the subtract doesn't have that check, that check is not needed as we don't use the last values at all