pub struct SpillManager {
env: Arc<RuntimeEnv>,
pub(crate) metrics: SpillMetrics,
schema: Arc<Schema>,
batch_read_buffer_capacity: usize,
pub(crate) compression: SpillCompression,
}Expand description
The SpillManager is responsible for the following tasks:
- Reading and writing
RecordBatches to raw files based on the provided configurations. - Updating the associated metrics.
Note: The caller (external operators such as SortExec) is responsible for interpreting the spilled files.
For example, all records within the same spill file are ordered according to a specific order.
Fields§
§env: Arc<RuntimeEnv>§metrics: SpillMetrics§schema: Arc<Schema>§batch_read_buffer_capacity: usize§compression: SpillCompressionImplementations§
Source§impl SpillManager
impl SpillManager
pub fn new( env: Arc<RuntimeEnv>, metrics: SpillMetrics, schema: Arc<Schema>, ) -> SpillManager
pub fn with_batch_read_buffer_capacity( self, batch_read_buffer_capacity: usize, ) -> SpillManager
pub fn with_compression_type( self, spill_compression: SpillCompression, ) -> SpillManager
Sourcepub fn create_in_progress_file(
&self,
request_msg: &str,
) -> Result<InProgressSpillFile, DataFusionError>
pub fn create_in_progress_file( &self, request_msg: &str, ) -> Result<InProgressSpillFile, DataFusionError>
Creates a temporary file for in-progress operations, returning an error message if file creation fails. The file can be used to append batches incrementally and then finish the file when done.
Sourcepub fn spill_record_batch_and_finish(
&self,
batches: &[RecordBatch],
request_msg: &str,
) -> Result<Option<RefCountedTempFile>, DataFusionError>
pub fn spill_record_batch_and_finish( &self, batches: &[RecordBatch], request_msg: &str, ) -> Result<Option<RefCountedTempFile>, DataFusionError>
Spill input batches into a single file in a atomic operation. If it is
intended to incrementally write in-memory batches into the same spill file,
use Self::create_in_progress_file instead.
None is returned if no batches are spilled.
§Errors
- Returns an error if spilling would exceed the disk usage limit configured
by
max_temp_directory_sizeinDiskManager
Sourcepub fn read_spill_as_stream(
&self,
spill_file_path: RefCountedTempFile,
max_record_batch_memory: Option<usize>,
) -> Result<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, DataFusionError>
pub fn read_spill_as_stream( &self, spill_file_path: RefCountedTempFile, max_record_batch_memory: Option<usize>, ) -> Result<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, DataFusionError>
Reads a spill file as a stream. The file must be created by the current SpillManager.
This method will generate output in FIFO order: the batch appended first
will be read first.
Trait Implementations§
Source§impl Clone for SpillManager
impl Clone for SpillManager
Source§fn clone(&self) -> SpillManager
fn clone(&self) -> SpillManager
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 SpillManager
impl !RefUnwindSafe for SpillManager
impl Send for SpillManager
impl Sync for SpillManager
impl Unpin for SpillManager
impl !UnwindSafe for SpillManager
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more