datafusion_common::stats

Enum Precision

Source
pub enum Precision<T: Debug + Clone + PartialEq + Eq + PartialOrd> {
    Exact(T),
    Inexact(T),
    Absent,
}
Expand description

Represents a value with a degree of certainty. Precision is used to propagate information the precision of statistical values.

Variants§

§

Exact(T)

The exact value is known

§

Inexact(T)

The value is not known exactly, but is likely close to this value

§

Absent

Nothing is known about the value

Implementations§

Source§

impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Precision<T>

Source

pub fn get_value(&self) -> Option<&T>

If we have some value (exact or inexact), it returns that value. Otherwise, it returns None.

Source

pub fn map<U, F>(self, f: F) -> Precision<U>
where F: Fn(T) -> U, U: Debug + Clone + PartialEq + Eq + PartialOrd,

Transform the value in this Precision object, if one exists, using the given function. Preserves the exactness state.

Source

pub fn is_exact(&self) -> Option<bool>

Returns Some(true) if we have an exact value, Some(false) if we have an inexact value, and None if there is no value.

Source

pub fn max(&self, other: &Precision<T>) -> Precision<T>

Returns the maximum of two (possibly inexact) values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Source

pub fn min(&self, other: &Precision<T>) -> Precision<T>

Returns the minimum of two (possibly inexact) values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Source

pub fn to_inexact(self) -> Self

Demotes the precision state from exact to inexact (if present).

Source§

impl Precision<usize>

Source

pub fn add(&self, other: &Precision<usize>) -> Precision<usize>

Calculates the sum of two (possibly inexact) usize values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Source

pub fn sub(&self, other: &Precision<usize>) -> Precision<usize>

Calculates the difference of two (possibly inexact) usize values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Source

pub fn multiply(&self, other: &Precision<usize>) -> Precision<usize>

Calculates the multiplication of two (possibly inexact) usize values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Source

pub fn with_estimated_selectivity(self, selectivity: f64) -> Self

Return the estimate of applying a filter with estimated selectivity selectivity to this Precision. A selectivity of 1.0 means that all rows are selected. A selectivity of 0.5 means half the rows are selected. Will always return inexact statistics.

Source§

impl Precision<ScalarValue>

Source

pub fn add(&self, other: &Precision<ScalarValue>) -> Precision<ScalarValue>

Calculates the sum of two (possibly inexact) ScalarValue values, conservatively propagating exactness information. If one of the input values is Precision::Absent, the result is Absent too.

Trait Implementations§

Source§

impl<T: Clone + Debug + Clone + PartialEq + Eq + PartialOrd> Clone for Precision<T>

Source§

fn clone(&self) -> Precision<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Debug for Precision<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Default for Precision<T>

Source§

fn default() -> Precision<T>

Returns the “default value” for a type. Read more
Source§

impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Display for Precision<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq + Debug + Clone + PartialEq + Eq + PartialOrd> PartialEq for Precision<T>

Source§

fn eq(&self, other: &Precision<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Copy + Debug + Clone + PartialEq + Eq + PartialOrd> Copy for Precision<T>

Source§

impl<T: Eq + Debug + Clone + PartialEq + Eq + PartialOrd> Eq for Precision<T>

Source§

impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> StructuralPartialEq for Precision<T>

Auto Trait Implementations§

§

impl<T> Freeze for Precision<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Precision<T>
where T: RefUnwindSafe,

§

impl<T> Send for Precision<T>
where T: Send,

§

impl<T> Sync for Precision<T>
where T: Sync,

§

impl<T> Unpin for Precision<T>
where T: Unpin,

§

impl<T> UnwindSafe for Precision<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,