Skip to main content

BoundedExecutor

Struct BoundedExecutor 

Source
pub struct BoundedExecutor { /* private fields */ }
Expand description

Parse an input in bounded batches to stay within a memory budget.

Implementations§

Source§

impl BoundedExecutor

Source

pub fn new(budget: MemoryBudget) -> Self

Source

pub fn with_split_cap(self, cap: usize) -> Self

Override the split cap (default MAX_SPLIT_CHUNKS). Raising it may be needed for very large files with small budgets, where capped batches would otherwise overshoot the budget.

Source

pub fn run_bytes_stream<P, C>( &self, bytes: &[u8], splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, consumer: &mut C, ) -> Result<()>

Parse an in-memory byte slice in bounded batches, calling consumer per batch.

Chunks are sliced directly from bytes; no file I/O occurs. This is the streaming entry point for adapters holding decompressed data. The budget controls batch sizing; allocator, parser, input, and Arrow overhead can raise process RSS above this target.

Source

pub fn run_bytes_stream_with_stats<P, C>( &self, bytes: &[u8], splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, consumer: &mut C, ) -> Result<StreamStats>

Like BoundedExecutor::run_bytes_stream, but reports a StreamStats summary including the peak tracked engine memory.

The input slice is caller-owned, so it is not charged to the ledger; peak_tracked_bytes covers builders and in-flight batches only.

Source

pub fn run_bytes<P>( &self, bytes: &[u8], splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, ) -> Result<Vec<RecordBatch>>
where P: RecordParser + Clone + Send + Sync,

Parse an in-memory byte slice in bounded batches, returning one RecordBatch per batch.

Chunks are sliced directly from bytes; no file I/O occurs. This is the entry point for adapters holding decompressed or streamed-in data.

Source

pub fn run_stream<P, C>( &self, path: &Path, splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, prefault: bool, consumer: &mut C, ) -> Result<()>

Parse path in batches, calling consumer per batch (streaming).

Compressed inputs are decompressed up front and served via run_bytes_stream. Uncompressed inputs with mmap use the seek-based path with a reusable chunk buffer to keep RSS constant.

Source

pub fn run_stream_with_stats<P, C>( &self, path: &Path, splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, prefault: bool, consumer: &mut C, ) -> Result<StreamStats>

Like BoundedExecutor::run_stream, but reports a StreamStats summary including the peak tracked engine memory.

Source

pub fn run<P>( &self, path: &Path, splitter: &dyn Splitter, parser: P, plan: Arc<ExecutionPlan>, prefault: bool, ) -> Result<Vec<RecordBatch>>
where P: RecordParser + Clone + Send + Sync,

Parse path in batches, returning one RecordBatch per batch.

The caller is responsible for concatenating the batches if a single table is desired.

Compressed inputs (see InputBuffer::open) are decompressed up front and served from memory via BoundedExecutor::run_bytes. Uncompressed inputs on platforms with the mmap feature retain the seek-based path: the mapping is dropped after planning and each chunk is read from disk on demand, keeping resident memory low.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

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.