Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions encodings/bytebool/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ impl vortex_array::arrays::dict::take::TakeExecute for vortex_bytebool::ByteBool

pub fn vortex_bytebool::ByteBool::take(array: vortex_array::array::view::ArrayView<'_, Self>, indices: &vortex_array::array::erased::ArrayRef, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::erased::ArrayRef>>

impl vortex_array::arrays::filter::kernel::FilterReduce for vortex_bytebool::ByteBool

pub fn vortex_bytebool::ByteBool::filter(array: vortex_array::array::view::ArrayView<'_, Self>, mask: &vortex_mask::Mask) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::erased::ArrayRef>>

impl vortex_array::arrays::slice::SliceReduce for vortex_bytebool::ByteBool

pub fn vortex_bytebool::ByteBool::slice(array: vortex_array::array::view::ArrayView<'_, Self>, range: core::ops::range::Range<usize>) -> vortex_error::VortexResult<core::option::Option<vortex_array::array::erased::ArrayRef>>
Expand Down
2 changes: 2 additions & 0 deletions encodings/bytebool/src/rules.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use vortex_array::arrays::filter::FilterReduceAdaptor;
use vortex_array::arrays::slice::SliceReduceAdaptor;
use vortex_array::optimizer::rules::ParentRuleSet;
use vortex_array::scalar_fn::fns::cast::CastReduceAdaptor;
Expand All @@ -12,4 +13,5 @@ pub(crate) static RULES: ParentRuleSet<ByteBool> = ParentRuleSet::new(&[
ParentRuleSet::lift(&CastReduceAdaptor(ByteBool)),
ParentRuleSet::lift(&MaskReduceAdaptor(ByteBool)),
ParentRuleSet::lift(&SliceReduceAdaptor(ByteBool)),
ParentRuleSet::lift(&FilterReduceAdaptor(ByteBool)),
]);
23 changes: 23 additions & 0 deletions encodings/bytebool/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ use std::ops::Range;
use vortex_array::ArrayRef;
use vortex_array::ArrayView;
use vortex_array::IntoArray;
use vortex_array::arrays::filter::FilterReduce;
use vortex_array::arrays::slice::SliceReduce;
use vortex_error::VortexResult;
use vortex_mask::AllOr;
use vortex_mask::Mask;

use crate::ByteBool;
use crate::ByteBoolData;
Expand All @@ -23,3 +26,23 @@ impl SliceReduce for ByteBool {
))
}
}

impl FilterReduce for ByteBool {
fn filter(array: ArrayView<'_, Self>, mask: &Mask) -> VortexResult<Option<ArrayRef>> {
let ranges = match mask.slices() {
AllOr::Some(slices) => slices,
// Precondition: FilterReduce only runs for non-trivial masks.
AllOr::All | AllOr::None => {
unreachable!("precondition violated: expected a Mask::Values slice list")
}
};
let ranges: Vec<Range<usize>> = ranges.iter().map(|&(s, e)| s..e).collect();
Ok(Some(
ByteBoolData::new(
array.buffer().filter_typed::<u8>(&ranges)?,
array.validity().filter(mask)?,
)
.into_array(),
))
}
}
Loading
Loading