pub struct SpillPoolWriter { /* private fields */ }Expand description
Writer for a spill pool. Provides coordinated write access with FIFO semantics.
Created by channel. See that function for architecture diagrams and usage examples.
The writer is Clone, allowing multiple writers to coordinate on the same pool.
All clones share the same current write file and coordinate file rotation.
The writer automatically manages file rotation based on the max_file_size_bytes
configured in channel. When the last writer clone is dropped, it finalizes the
current file so readers can access all written data.
Implementations§
Source§impl SpillPoolWriter
impl SpillPoolWriter
Sourcepub fn push_batch(&self, batch: &RecordBatch) -> Result<(), DataFusionError>
pub fn push_batch(&self, batch: &RecordBatch) -> Result<(), DataFusionError>
Spills a batch to the pool, rotating files when necessary.
If the current file would exceed max_file_size_bytes after adding
this batch, the file is finalized and a new one is started.
See channel for overall architecture and examples.
§File Rotation Logic
push_batch()
│
▼
Current file exists?
│
├─ No ──▶ Create new file ──▶ Add to shared queue
│ Wake readers
▼
Write batch to current file
│
▼
estimated_size > max_file_size_bytes?
│
├─ No ──▶ Keep current file for next batch
│
▼
Yes: finish() current file
Mark writer_finished = true
Wake readers
│
▼
Next push_batch() creates new file§Errors
Returns an error if disk I/O fails or disk quota is exceeded.
Trait Implementations§
Source§impl Clone for SpillPoolWriter
impl Clone for SpillPoolWriter
Source§fn clone(&self) -> SpillPoolWriter
fn clone(&self) -> SpillPoolWriter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SpillPoolWriter
impl !RefUnwindSafe for SpillPoolWriter
impl Send for SpillPoolWriter
impl Sync for SpillPoolWriter
impl Unpin for SpillPoolWriter
impl UnsafeUnpin for SpillPoolWriter
impl !UnwindSafe for SpillPoolWriter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more