-
Notifications
You must be signed in to change notification settings - Fork 786
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
Use SlicesIterator for ArrayData Equality #3198
Changes from 1 commit
24788ad
18d6559
8519e6a
e1eb72c
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 |
---|---|---|
|
@@ -28,3 +28,4 @@ pub mod transform; | |
pub mod bit_iterator; | ||
pub mod bit_mask; | ||
pub mod decimal; | ||
pub mod slices_iterator; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use crate::bit_iterator::BitSliceIterator; | ||
use arrow_buffer::Buffer; | ||
|
||
/// An iterator of `(usize, usize)` each representing an interval | ||
/// `[start, end)` whose slots of a bitmap [Buffer] are true. Each | ||
/// interval corresponds to a contiguous region of memory to be | ||
/// "taken" from an array to be filtered. | ||
/// | ||
/// ## Notes: | ||
/// | ||
/// Only performant for filters that copy across long contiguous runs | ||
#[derive(Debug)] | ||
pub struct SlicesIterator<'a>(BitSliceIterator<'a>); | ||
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. Moving this is a breaking change, as it is exposed publicly - https://docs.rs/arrow-select/latest/arrow_select/filter/struct.SlicesIterator.html |
||
|
||
impl<'a> SlicesIterator<'a> { | ||
pub fn new_from_buffer(values: &'a Buffer, offset: usize, len: usize) -> Self { | ||
Self(BitSliceIterator::new(values, offset, len)) | ||
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. At this point why not just use |
||
} | ||
} | ||
|
||
impl<'a> Iterator for SlicesIterator<'a> { | ||
type Item = (usize, usize); | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
self.0.next() | ||
} | ||
} |
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.
How did you come up with 0.4, not saying it is a bad choice, just curious
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.
It came from benchmarking.
equal_nulls_512
has 0.5 null density, and this doesn't improve it. So I pick 0.4 as the threshold.