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
impl ColumnStats
Sourcepub fn new() -> Self
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());Sourcepub fn with_row_count(self, n: u64) -> Self
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));Sourcepub fn with_distinct_count(self, n: u64) -> Self
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));Sourcepub fn with_null_count(self, n: u64) -> Self
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));Sourcepub fn with_upper_bound(self, n: u64) -> Self
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
impl Clone for ColumnStats
Source§fn clone(&self) -> ColumnStats
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColumnStats
impl Debug for ColumnStats
Source§impl Default for ColumnStats
impl Default for ColumnStats
Source§fn default() -> ColumnStats
fn default() -> ColumnStats
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ColumnStats
impl<'de> Deserialize<'de> for ColumnStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ColumnStats
impl RefUnwindSafe for ColumnStats
impl Send for ColumnStats
impl Sync for ColumnStats
impl Unpin for ColumnStats
impl UnsafeUnpin for ColumnStats
impl UnwindSafe for ColumnStats
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