pub struct MostCommonValues {
pub values: Vec<(ColumnValue, f64)>,
}Expand description
Most-common-values list for a column.
Each entry is (value, frequency) where frequency is in [0, 1]
— the fraction of total rows holding that exact value. Use for
equality selectivity on skewed columns where one or two values
dominate.
Fields§
§values: Vec<(ColumnValue, f64)>Implementations§
Source§impl MostCommonValues
impl MostCommonValues
Sourcepub fn new(entries: Vec<(ColumnValue, f64)>) -> MostCommonValues
pub fn new(entries: Vec<(ColumnValue, f64)>) -> MostCommonValues
Construct from a (value, frequency) slice. Frequencies are
expected to already be in [0, 1]; the constructor sorts by
frequency descending so callers can .values[0] to get the
hottest key.
Sourcepub fn frequency_of(&self, value: &ColumnValue) -> Option<f64>
pub fn frequency_of(&self, value: &ColumnValue) -> Option<f64>
Lookup value in the MCV list and return its frequency, or
None if it isn’t tracked.
Sourcepub fn total_frequency(&self) -> f64
pub fn total_frequency(&self) -> f64
Sum of all tracked frequencies (always <= 1.0 if constructed
from a valid sample).
Trait Implementations§
Source§impl Clone for MostCommonValues
impl Clone for MostCommonValues
Source§fn clone(&self) -> MostCommonValues
fn clone(&self) -> MostCommonValues
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MostCommonValues
impl Debug for MostCommonValues
Source§impl Default for MostCommonValues
impl Default for MostCommonValues
Source§fn default() -> MostCommonValues
fn default() -> MostCommonValues
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for MostCommonValues
impl Freeze for MostCommonValues
impl Move for MostCommonValues
impl RefUnwindSafe for MostCommonValues
impl Send for MostCommonValueswhere
RawVecInner: Send,
impl Sync for MostCommonValueswhere
RawVecInner: Sync,
impl Unpin for MostCommonValues
impl UnsafeUnpin for MostCommonValues
impl UnwindSafe for MostCommonValueswhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request