Skip to main content

StopCondition

Enum StopCondition 

Source
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 other than StopCondition::MaxRows are checked per chunk for performance. Their observed boundary can therefore vary with chunk size.

Variants§

§

MaxRows(u64)

Stop after processing this many rows.

§

MaxBytes(u64)

Stop after consuming this many bytes from the source.

The CSV streaming engines, file and async, size each read to the budget that remains, so they stop at the end of the first record at or past the limit: bytes_consumed counts every source byte read, including the header, and exceeds the value by less than one record. The async JSON reader still evaluates it after whole chunks.

§

SchemaStable

Stop when column types have not changed for approximately N rows (accumulated across chunks).

Fields

§consecutive_stable_rows: u64

Approximate number of rows with no type changes before stopping. Rows are accumulated per-chunk, so the actual count depends on chunk granularity.

§

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

Source

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).

Source

pub fn quality_sample() -> Self

Preset for quality sampling: stop after 50K rows, 50 MB, or 95% confidence.

Source

pub fn max_rows(&self) -> Option<u64>

The row count at which this condition can first trigger on rows alone, if any.

Mirrors the internal evaluate method: 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.

Source

pub fn max_bytes(&self) -> Option<u64>

The byte count at which this condition can first trigger on bytes alone, if any: the byte counterpart of max_rows, with the same Any/All rules.

The incremental engine sizes its reads to the budget that remains under it, so the scan stops at a record boundary rather than at the end of a large chunk.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StopCondition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StopCondition

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V