pub struct LocalChunkCollector { /* private fields */ }Expand description
Thread-local terminal accumulator for query results.
Implementations§
Source§impl LocalChunkCollector
impl LocalChunkCollector
pub fn new(col_names: Vec<String>) -> Self
Sourcepub fn attach_spill_manager(&mut self, manager: Arc<SpillManager>)
pub fn attach_spill_manager(&mut self, manager: Arc<SpillManager>)
Attach a spill manager for spill-through collect.
When no explicit threshold was configured via
Self::set_spill_threshold_rows, the manager’s effective threshold
(config value or default) is adopted. A threshold of u64::MAX
(from Some(0) config) disables collector spill.
Sourcepub fn push_chunk(&mut self, chunk: &mut DataChunk) -> Result<(), QueryError>
pub fn push_chunk(&mut self, chunk: &mut DataChunk) -> Result<(), QueryError>
Move all visible (expanded) rows of chunk into the collector,
splitting them across fixed-size blocks or spilling them to disk once
the threshold is exceeded.
Sourcepub fn merge(&mut self, other: LocalChunkCollector) -> Result<(), QueryError>
pub fn merge(&mut self, other: LocalChunkCollector) -> Result<(), QueryError>
Merge another collector by moving whole blocks (no per-Value clone).
Spilled runs are concatenated in order; both open writers are
finalized first so ordering is preserved. Merging two spilled
collectors requires identical column names and the same spill manager
(runs live in the manager’s directory); otherwise an error is
returned and the caller should drain via into_rows first. Pure
in-memory merges keep the previous unchecked behavior.
Sourcepub fn total_logical_rows(&self) -> u128
pub fn total_logical_rows(&self) -> u128
Expanded row count observed (selection + multiplicity applied).
pub fn is_empty(&self) -> bool
pub fn col_names(&self) -> &[String]
Sourcepub fn finish_spill(&mut self) -> Result<(), QueryError>
pub fn finish_spill(&mut self) -> Result<(), QueryError>
Finalize the open run, if any, so all spilled rows are readable and
counters are exact. Idempotent; into_rows and drain_rows call it
automatically, while streaming collect paths call it explicitly
before snapshotting observability counters.
Sourcepub fn into_rows(self) -> Result<(Vec<Vec<Value>>, Vec<String>), QueryError>
pub fn into_rows(self) -> Result<(Vec<Vec<Value>>, Vec<String>), QueryError>
Full ordered results: spilled runs replayed in write order, then memory blocks. Peak memory is bounded by the largest single run.
Sourcepub fn drain_rows(&mut self) -> Result<Vec<Vec<Value>>, QueryError>
pub fn drain_rows(&mut self) -> Result<Vec<Vec<Value>>, QueryError>
Segmented results: each call returns at most one run’s rows, so streaming consumers never hold more than a single run in memory. After the runs are exhausted the memory blocks are returned whole, then empty vectors signal completion.
Sourcepub fn into_blocks(self) -> (Vec<Vec<Vec<Value>>>, Vec<String>)
pub fn into_blocks(self) -> (Vec<Vec<Vec<Value>>>, Vec<String>)
Block-partitioned memory rows.
Only valid for in-memory collectors; spilled state must be consumed
via Self::into_rows or Self::drain_rows.
Sourcepub fn iter_rows(&self) -> impl Iterator<Item = &Vec<Value>>
pub fn iter_rows(&self) -> impl Iterator<Item = &Vec<Value>>
Ordered cursor over memory blocks only.
When spilled, the disk portion is NOT included; paged consumers must
use Self::drain_rows, full consumers Self::into_rows.
pub fn num_blocks(&self) -> usize
Sourcepub fn is_spilled(&self) -> bool
pub fn is_spilled(&self) -> bool
Whether any row has been spilled to disk.
Sourcepub fn spilled_rows(&self) -> u64
pub fn spilled_rows(&self) -> u64
Rows written to disk so far.
Sourcepub fn spilled_bytes(&self) -> u64
pub fn spilled_bytes(&self) -> u64
Bytes written to disk so far (on-disk file sizes).
Sourcepub fn spilled_run_count(&self) -> usize
pub fn spilled_run_count(&self) -> usize
Number of finalized spill runs.
Sourcepub fn set_spill_threshold_rows(&mut self, threshold: u64)
pub fn set_spill_threshold_rows(&mut self, threshold: u64)
Configure the logical-row threshold that will trigger spill-through collect once a spill manager is attached.
Sourcepub fn spill_threshold_exceeded(&self) -> bool
pub fn spill_threshold_exceeded(&self) -> bool
Whether the configured spill threshold has been exceeded.
Trait Implementations§
Source§impl Debug for LocalChunkCollector
impl Debug for LocalChunkCollector
Auto Trait Implementations§
impl Freeze for LocalChunkCollector
impl RefUnwindSafe for LocalChunkCollector
impl Send for LocalChunkCollector
impl Sync for LocalChunkCollector
impl Unpin for LocalChunkCollector
impl UnsafeUnpin for LocalChunkCollector
impl UnwindSafe for LocalChunkCollector
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.