Enum datafusion_common::stats::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>
impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Precision<T>
sourcepub fn get_value(&self) -> Option<&T>
pub fn get_value(&self) -> Option<&T>
If we have some value (exact or inexact), it returns that value.
Otherwise, it returns None
.
sourcepub fn map<U, F>(self, f: F) -> Precision<U>
pub fn map<U, F>(self, f: F) -> Precision<U>
Transform the value in this Precision
object, if one exists, using
the given function. Preserves the exactness state.
sourcepub fn is_exact(&self) -> Option<bool>
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.
sourcepub fn max(&self, other: &Precision<T>) -> Precision<T>
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.
sourcepub fn min(&self, other: &Precision<T>) -> Precision<T>
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.
sourcepub fn to_inexact(self) -> Self
pub fn to_inexact(self) -> Self
Demotes the precision state from exact to inexact (if present).
source§impl Precision<usize>
impl Precision<usize>
sourcepub fn add(&self, other: &Precision<usize>) -> Precision<usize>
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.
sourcepub fn sub(&self, other: &Precision<usize>) -> Precision<usize>
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.
sourcepub fn multiply(&self, other: &Precision<usize>) -> Precision<usize>
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.
sourcepub fn with_estimated_selectivity(self, selectivity: f64) -> Self
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>
impl Precision<ScalarValue>
sourcepub fn add(&self, other: &Precision<ScalarValue>) -> Precision<ScalarValue>
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§
impl<T: Eq + Debug + Clone + PartialEq + Eq + PartialOrd> Eq for Precision<T>
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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.