pub enum StopCondition {
MaxRows(u64),
MaxBytes(u64),
SchemaStable {
consecutive_stable_rows: u64,
},
ConfidenceThreshold(f64),
MemoryPressure(f64),
Any(Vec<StopCondition>),
All(Vec<StopCondition>),
Never,
}Expand description
A composable condition that can trigger early termination of profiling.
Conditions are checked per-chunk (not per-row) for performance. The actual row count at termination may slightly exceed the limit.
Variants§
MaxRows(u64)
Stop after processing this many rows.
MaxBytes(u64)
Stop after consuming this many bytes from the source.
SchemaStable
Stop when column types have not changed for approximately N rows (accumulated across chunks).
Fields
ConfidenceThreshold(f64)
Stop when rows_processed / estimated_total >= threshold.
Only meaningful when an estimated total row count is available. When no estimate exists, this condition is inert.
MemoryPressure(f64)
Stop when memory usage exceeds this fraction of the configured limit.
Value in 0.0..=1.0 (e.g., 0.9 = 90% of memory limit).
Any(Vec<StopCondition>)
Stop when any sub-condition triggers.
All(Vec<StopCondition>)
Stop when all sub-conditions have triggered.
Never
Never stop early — process the entire stream (default).
Implementations§
Source§impl StopCondition
impl StopCondition
Sourcepub fn schema_inference() -> Self
pub fn schema_inference() -> Self
Preset for schema-only profiling: stop after 10K rows or when schema stabilizes (no type changes for 1,000 consecutive rows).
Sourcepub fn quality_sample() -> Self
pub fn quality_sample() -> Self
Preset for quality sampling: stop after 50K rows, 50 MB, or 95% confidence.
Sourcepub fn max_rows(&self) -> Option<u64>
pub fn max_rows(&self) -> Option<u64>
The row count at which this condition can first trigger on rows alone, if any.
Mirrors [evaluate]: Any fires as soon as one child fires, so it takes
the minimum of the children that a row count can trigger. All fires
only once every child has fired, so it takes the maximum, and yields
None if any child cannot be triggered by rows at all (a byte cap,
Never, …) — such a condition can never be satisfied by rows alone.
Used two ways: parsers that can only enforce a row cap consult it after
checking is_row_limit_only, and the
incremental engine uses it as a per-row guardrail alongside the real
evaluator.
Sourcepub fn is_row_limit_only(&self) -> bool
pub fn is_row_limit_only(&self) -> bool
Whether this condition is expressible purely as a row limit.
Never never fires; a bare MaxRows is a row cap; a composite qualifies
when every leaf is one of those. Anything else (byte caps, schema
stability, confidence) needs a real evaluator, so a parser that can only
cap rows must not silently accept it.
Trait Implementations§
Source§impl Clone for StopCondition
impl Clone for StopCondition
Source§fn clone(&self) -> StopCondition
fn clone(&self) -> StopCondition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more