pub struct CompletenessAnalyzer { /* private fields */ }Expand description
Analyzer that computes the fraction of non-null values for a column.
Completeness is a fundamental data quality metric that measures how much of the expected data is actually present.
§Example
ⓘ
use term_guard::analyzers::basic::CompletenessAnalyzer;
use datafusion::prelude::*;
let ctx = SessionContext::new();
// Register your data table
let analyzer = CompletenessAnalyzer::new("user_id");
let state = analyzer.compute_state_from_data(&ctx).await?;
let metric = analyzer.compute_metric_from_state(&state)?;
if let MetricValue::Double(completeness) = metric {
println!("Column completeness: {:.2}%", completeness * 100.0);
}Implementations§
Trait Implementations§
Source§impl Analyzer for CompletenessAnalyzer
impl Analyzer for CompletenessAnalyzer
Source§type State = CompletenessState
type State = CompletenessState
The state type for incremental computation.
Source§type Metric = MetricValue
type Metric = MetricValue
The metric type produced by this analyzer.
Source§fn compute_state_from_data<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Self::State>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compute_state_from_data<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Self::State>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Computes the state from the input data. Read more
Source§fn compute_metric_from_state(
&self,
state: &Self::State,
) -> AnalyzerResult<Self::Metric>
fn compute_metric_from_state( &self, state: &Self::State, ) -> AnalyzerResult<Self::Metric>
Computes the final metric from the accumulated state. Read more
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns a description of what this analyzer computes. Read more
Source§fn metric_key(&self) -> String
fn metric_key(&self) -> String
Returns the metric key for storing results. Read more
Source§fn columns(&self) -> Vec<&str>
fn columns(&self) -> Vec<&str>
Returns the column(s) this analyzer operates on, if any. Read more
Source§fn merge_states(&self, states: Vec<Self::State>) -> AnalyzerResult<Self::State>
fn merge_states(&self, states: Vec<Self::State>) -> AnalyzerResult<Self::State>
Merges multiple states into a single state. Read more
Source§fn is_combinable(&self) -> bool
fn is_combinable(&self) -> bool
Indicates whether this analyzer can be combined with others. Read more
Source§impl Clone for CompletenessAnalyzer
impl Clone for CompletenessAnalyzer
Source§fn clone(&self) -> CompletenessAnalyzer
fn clone(&self) -> CompletenessAnalyzer
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 moreSource§impl Debug for CompletenessAnalyzer
impl Debug for CompletenessAnalyzer
Source§impl GroupedAnalyzer for CompletenessAnalyzer
impl GroupedAnalyzer for CompletenessAnalyzer
Source§type GroupedState = GroupedCompletenessState
type GroupedState = GroupedCompletenessState
The grouped state type for this analyzer.
Source§fn compute_grouped_state_from_data<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
config: &'life2 GroupingConfig,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Self::GroupedState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn compute_grouped_state_from_data<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
config: &'life2 GroupingConfig,
) -> Pin<Box<dyn Future<Output = AnalyzerResult<Self::GroupedState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Computes grouped state from data. Read more
Source§fn compute_grouped_metrics_from_state(
&self,
state: &Self::GroupedState,
) -> AnalyzerResult<GroupedMetrics>
fn compute_grouped_metrics_from_state( &self, state: &Self::GroupedState, ) -> AnalyzerResult<GroupedMetrics>
Computes metrics from grouped state.
Source§fn with_grouping(self, config: GroupingConfig) -> GroupedAnalyzerWrapper<Self>where
Self: Sized + 'static,
fn with_grouping(self, config: GroupingConfig) -> GroupedAnalyzerWrapper<Self>where
Self: Sized + 'static,
Configures grouping for this analyzer.
Auto Trait Implementations§
impl Freeze for CompletenessAnalyzer
impl RefUnwindSafe for CompletenessAnalyzer
impl Send for CompletenessAnalyzer
impl Sync for CompletenessAnalyzer
impl Unpin for CompletenessAnalyzer
impl UnwindSafe for CompletenessAnalyzer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more