Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Jun 24, 2024
1 parent 4178169 commit e429913
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct BitPackedSearch {
impl BitPackedSearch {
pub fn new(array: &BitPackedArray) -> Self {
Self {
packed: array.packed().flatten_primitive().unwrap(),
packed: array.packed().into_primitive().unwrap(),
length: array.len(),
bit_width: array.bit_width(),
min_patch_offset: array.patches().map(|p| {
Expand Down
8 changes: 0 additions & 8 deletions encodings/fastlanes/src/for/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ impl EncodingCompression for FoREncoding {
return None;
}

match_each_integer_ptype!(parray.ptype(), |$P| {
let min: $P = parray.statistics().compute_min()?;
let max: $P = parray.statistics().compute_max()?;
if max.wrapping_sub(min) < 0 {
return None;
}
});

Some(self)
}

Expand Down
8 changes: 7 additions & 1 deletion encodings/fastlanes/src/for/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ impl SearchSortedFn for FoRArray {
let shifted_min = min >> self.shift();
let unwrapped_value: $P = value.cast(self.dtype())?.try_into().unwrap();
let shifted_value: $P = unwrapped_value >> self.shift();
// Make sure that smaller values are still smaller and not larger than (which they would be after wrapping_sub)
if shifted_value < shifted_min {
return Ok(SearchResult::NotFound(0));
}
let translated_scalar = Scalar::primitive(shifted_value.wrapping_sub(shifted_min), value.dtype().nullability());

let translated_scalar = Scalar::primitive(
shifted_value.wrapping_sub(shifted_min),
value.dtype().nullability(),
)
.reinterpret_cast(self.ptype().to_unsigned());
search_sorted(&self.encoded(), translated_scalar, side)
})
}
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/sparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use vortex_error::vortex_bail;
use vortex_scalar::Scalar;

use crate::array::constant::ConstantArray;
use crate::compute::scalar_at::scalar_at;
use crate::compute::search_sorted::{search_sorted, SearchSortedSide};
use crate::compute::unary::scalar_at::scalar_at;
use crate::stats::ArrayStatisticsCompute;
use crate::validity::{ArrayValidity, LogicalValidity};
use crate::visitor::{AcceptArrayVisitor, ArrayVisitor};
Expand Down

0 comments on commit e429913

Please sign in to comment.