Skip to main content

ColumnStats

Struct ColumnStats 

Source
pub struct ColumnStats {
    pub row_count: Option<u64>,
    pub null_count: Option<u64>,
    pub distinct_count: Option<u64>,
    pub min: Option<Bound>,
    pub max: Option<Bound>,
    pub upper_bound_rows: Option<u64>,
}
Expand description

Canonical column statistics surface.

Intentionally a superset of DataFusion’s ColumnStatistics and DuckDB’s internal BaseStatistics so a single instance can satisfy either engine.

§Examples

use samkhya_core::ColumnStats;

let stats = ColumnStats::new()
    .with_row_count(10_000)
    .with_distinct_count(8_421)
    .with_null_count(7)
    .with_upper_bound(10_000);
assert_eq!(stats.row_count, Some(10_000));
assert_eq!(stats.distinct_count, Some(8_421));
assert_eq!(stats.null_count, Some(7));
assert_eq!(stats.upper_bound_rows, Some(10_000));

Fields§

§row_count: Option<u64>§null_count: Option<u64>§distinct_count: Option<u64>§min: Option<Bound>§max: Option<Bound>§upper_bound_rows: Option<u64>

Inclusive ceiling derived from LpBound; correctors must not exceed this.

Implementations§

Source§

impl ColumnStats

Source

pub fn new() -> Self

Construct an empty stats record (all fields None).

§Examples
use samkhya_core::ColumnStats;

let s = ColumnStats::new();
assert!(s.row_count.is_none());
Source

pub fn with_row_count(self, n: u64) -> Self

Builder-style setter for row_count.

§Examples
use samkhya_core::ColumnStats;

let s = ColumnStats::new().with_row_count(100);
assert_eq!(s.row_count, Some(100));
Source

pub fn with_distinct_count(self, n: u64) -> Self

Builder-style setter for distinct_count.

§Examples
use samkhya_core::ColumnStats;

let s = ColumnStats::new().with_distinct_count(42);
assert_eq!(s.distinct_count, Some(42));
Source

pub fn with_null_count(self, n: u64) -> Self

Builder-style setter for null_count.

§Examples
use samkhya_core::ColumnStats;

let s = ColumnStats::new().with_null_count(3);
assert_eq!(s.null_count, Some(3));
Source

pub fn with_upper_bound(self, n: u64) -> Self

Builder-style setter for upper_bound_rows. The LpBound ceiling that downstream correctors must respect.

§Examples
use samkhya_core::ColumnStats;

let s = ColumnStats::new().with_upper_bound(10_000);
assert_eq!(s.upper_bound_rows, Some(10_000));

Trait Implementations§

Source§

impl Clone for ColumnStats

Source§

fn clone(&self) -> ColumnStats

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ColumnStats

Source§

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

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

impl Default for ColumnStats

Source§

fn default() -> ColumnStats

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

impl<'de> Deserialize<'de> for ColumnStats

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ColumnStats

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,