pub struct RowUniquenessTracker { /* private fields */ }Expand description
Full-stream row-duplicate tracking with bounded memory.
Every record’s fields are folded into a RowSignature and fed to a
CardinalityEstimator: duplicates are counted exactly while the
distinct-row signatures fit the estimator’s exact set, and estimated
(flagged approximate) once it spills to its HLL sketch. Unlike the
per-column reservoirs, this sees whole rows — including null-like values —
so the count is row-aligned by construction.
Implementations§
Source§impl RowUniquenessTracker
impl RowUniquenessTracker
pub fn observe(&mut self, signature: String)
pub fn rows_seen(&self) -> usize
Sourcepub fn duplicate_rows(&self) -> usize
pub fn duplicate_rows(&self) -> usize
Rows minus distinct rows; exact until the estimator spills.
pub fn is_approximate(&self) -> bool
Sourcepub fn mark_incomparable(&mut self)
pub fn mark_incomparable(&mut self)
Record that the signatures folded in so far were not all made against the same schema, so they cannot be compared with each other.
pub fn merge(&mut self, other: &RowUniquenessTracker)
pub fn memory_usage_bytes(&self) -> usize
Sourcepub fn exact_bytes(&self) -> usize
pub fn exact_bytes(&self) -> usize
Heap held by the exact set of row signatures: what Self::spill frees.
Sourcepub fn spill(&mut self)
pub fn spill(&mut self)
Answer the duplicate count from the sketch from here on, freeing the exact set. For memory pressure; the count is then reported approximate.
Sourcepub fn summary(&self) -> Option<RowDuplicateSummary>
pub fn summary(&self) -> Option<RowDuplicateSummary>
Summary for quality metrics, or None when no rows were observed
(e.g. an engine that never fed whole records through this tracker) or
when the signatures seen are not comparable with one another.