Skip to content

Commit

Permalink
moar
Browse files Browse the repository at this point in the history
  • Loading branch information
lwwmanning committed Oct 9, 2024
1 parent 9652876 commit dd15b5e
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions encodings/roaring/src/integer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use vortex::validity::{ArrayValidity, LogicalValidity, Validity};
use vortex::variants::{ArrayVariants, PrimitiveArrayTrait};
use vortex::visitor::{AcceptArrayVisitor, ArrayVisitor};
use vortex::{
impl_encoding, Array, ArrayDType as _, ArrayTrait, Canonical, IntoArray,
IntoCanonical, TypedArray,
impl_encoding, Array, ArrayDType as _, ArrayTrait, Canonical, IntoArray, IntoCanonical,
TypedArray,
};
use vortex_buffer::Buffer;
use vortex_dtype::Nullability::NonNullable;
Expand Down Expand Up @@ -134,21 +134,14 @@ impl AcceptArrayVisitor for RoaringIntArray {

impl ArrayStatisticsCompute for RoaringIntArray {
fn compute_statistics(&self, stat: Stat) -> VortexResult<StatsSet> {
let mut stats = self.statistics().to_set();
if stats.get(stat).is_some() {
return Ok(stats);
}

// possibly faster to write an accumulator over the iterator, though not necessarily
if stat == Stat::TrailingZeroFreq || stat == Stat::BitWidthFreq || stat == Stat::RunCount {
let primitive = PrimitiveArray::from_vec(self.bitmap().to_vec(), Validity::NonNullable);
if let Some(prim_stat) = primitive.statistics().compute(stat) {
stats.set(stat, prim_stat);
}
stats.merge(&primitive.statistics().to_set());
primitive.statistics().compute(stat);
Ok(primitive.statistics().to_set())
} else {
Ok(StatsSet::new())
}

Ok(stats)
}
}

Expand Down

0 comments on commit dd15b5e

Please sign in to comment.