pub struct SampleMetadata {
pub total_rows: usize,
pub sample_size: usize,
pub sampling_ratio: f64,
pub sampled: bool,
pub confidence_level: f64,
}Expand description
Metadata about a sample
Fields§
§total_rows: usizeTotal number of rows in the table
sample_size: usizeNumber of rows in the sample
sampling_ratio: f64Sampling ratio (sample_size / total_rows)
sampled: boolWhether sampling was actually used
confidence_level: f64Confidence level for statistical estimates
Implementations§
Source§impl SampleMetadata
impl SampleMetadata
Sourcepub fn new(
total_rows: usize,
sample_size: usize,
sampled: bool,
confidence_level: f64,
) -> Self
pub fn new( total_rows: usize, sample_size: usize, sampled: bool, confidence_level: f64, ) -> Self
Create metadata for a sample
Sourcepub fn extrapolate_count(&self, sample_count: usize) -> usize
pub fn extrapolate_count(&self, sample_count: usize) -> usize
Extrapolate a count from sample to full table
Given a count in the sample, estimate the count in the full table
Sourcepub fn extrapolate_frequency(&self, sample_frequency: f64) -> f64
pub fn extrapolate_frequency(&self, sample_frequency: f64) -> f64
Extrapolate a frequency/selectivity from sample to full table
Frequencies typically don’t need adjustment, but we apply a small confidence adjustment for small samples
Sourcepub fn standard_error(&self, proportion: f64) -> f64
pub fn standard_error(&self, proportion: f64) -> f64
Estimate the standard error for a proportion
Used to provide confidence intervals for selectivity estimates
Sourcepub fn confidence_interval(&self, proportion: f64) -> (f64, f64)
pub fn confidence_interval(&self, proportion: f64) -> (f64, f64)
Get confidence interval for a proportion estimate
Returns (lower_bound, upper_bound) for the confidence level
Trait Implementations§
Source§impl Clone for SampleMetadata
impl Clone for SampleMetadata
Source§fn clone(&self) -> SampleMetadata
fn clone(&self) -> SampleMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SampleMetadata
impl RefUnwindSafe for SampleMetadata
impl Send for SampleMetadata
impl Sync for SampleMetadata
impl Unpin for SampleMetadata
impl UnwindSafe for SampleMetadata
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