pub struct Histogram { /* private fields */ }Expand description
An equi-depth histogram.
Each bucket contains approximately the same number of rows.
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn new(buckets: Vec<HistogramBucket>) -> Self
pub fn new(buckets: Vec<HistogramBucket>) -> Self
Creates a new histogram with the given buckets.
Sourcepub fn build(sorted_values: &[Value], num_buckets: usize) -> Self
pub fn build(sorted_values: &[Value], num_buckets: usize) -> Self
Creates an equi-depth histogram from sorted values.
§Arguments
sorted_values- Values sorted in ascending order.num_buckets- Target number of buckets.
Sourcepub fn bucket_count(&self) -> usize
pub fn bucket_count(&self) -> usize
Returns the number of buckets.
Sourcepub fn buckets(&self) -> &[HistogramBucket]
pub fn buckets(&self) -> &[HistogramBucket]
Returns the buckets.
Sourcepub fn total_rows(&self) -> u64
pub fn total_rows(&self) -> u64
Returns the total row count.
Sourcepub fn total_distinct(&self) -> u64
pub fn total_distinct(&self) -> u64
Returns the total distinct count.
Sourcepub fn estimate_equality_selectivity(&self, value: &Value) -> f64
pub fn estimate_equality_selectivity(&self, value: &Value) -> f64
Estimates the selectivity of an equality predicate.
Returns the estimated fraction of rows that match the value.
Sourcepub fn estimate_range_selectivity(
&self,
lower: Option<&Value>,
upper: Option<&Value>,
lower_inclusive: bool,
upper_inclusive: bool,
) -> f64
pub fn estimate_range_selectivity( &self, lower: Option<&Value>, upper: Option<&Value>, lower_inclusive: bool, upper_inclusive: bool, ) -> f64
Estimates the selectivity of a range predicate.
§Arguments
lower- Lower bound (None for unbounded).upper- Upper bound (None for unbounded).lower_inclusive- Whether lower bound is inclusive.upper_inclusive- Whether upper bound is inclusive.
Sourcepub fn estimate_less_than_selectivity(
&self,
value: &Value,
inclusive: bool,
) -> f64
pub fn estimate_less_than_selectivity( &self, value: &Value, inclusive: bool, ) -> f64
Estimates the selectivity of a less-than predicate.
Sourcepub fn estimate_greater_than_selectivity(
&self,
value: &Value,
inclusive: bool,
) -> f64
pub fn estimate_greater_than_selectivity( &self, value: &Value, inclusive: bool, ) -> f64
Estimates the selectivity of a greater-than predicate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnwindSafe for Histogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more