pub struct BatchPartitioner {
state: BatchPartitionerState,
timer: Time,
}Expand description
A utility that can be used to partition batches based on Partitioning
Fields§
§state: BatchPartitionerState§timer: TimeImplementations§
Source§impl BatchPartitioner
impl BatchPartitioner
Sourcepub fn try_new(partitioning: Partitioning, timer: Time) -> Result<Self>
pub fn try_new(partitioning: Partitioning, timer: Time) -> Result<Self>
Create a new BatchPartitioner with the provided Partitioning
The time spent repartitioning will be recorded to timer
Sourcepub fn partition<F>(&mut self, batch: RecordBatch, f: F) -> Result<()>
pub fn partition<F>(&mut self, batch: RecordBatch, f: F) -> Result<()>
Partition the provided [RecordBatch] into one or more partitioned [RecordBatch]
based on the Partitioning specified on construction
f will be called for each partitioned [RecordBatch] with the corresponding
partition index. Any error returned by f will be immediately returned by this
function without attempting to publish further [RecordBatch]
The time spent repartitioning, not including time spent in f will be recorded
to the metrics::Time provided on construction
Sourcefn partition_iter(
&mut self,
batch: RecordBatch,
) -> Result<impl Iterator<Item = Result<(usize, RecordBatch)>> + Send + '_>
fn partition_iter( &mut self, batch: RecordBatch, ) -> Result<impl Iterator<Item = Result<(usize, RecordBatch)>> + Send + '_>
Actual implementation of partition.
The reason this was pulled out is that we need to have a variant of partition that works w/ sync functions,
and one that works w/ async. Using an iterator as an intermediate representation was the best way to achieve
this (so we don’t need to clone the entire implementation).
fn num_partitions(&self) -> usize
Auto Trait Implementations§
impl Freeze for BatchPartitioner
impl !RefUnwindSafe for BatchPartitioner
impl Send for BatchPartitioner
impl Sync for BatchPartitioner
impl Unpin for BatchPartitioner
impl !UnwindSafe for BatchPartitioner
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<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