pub struct DataChunkBuilder {
data_types: Vec<DataType>,
batch_size: usize,
array_builders: Vec<ArrayBuilderImpl>,
buffered_count: usize,
}
Expand description
Used as a buffer for accumulating rows.
Fields§
§data_types: Vec<DataType>
Data types for build array
batch_size: usize
§array_builders: Vec<ArrayBuilderImpl>
Buffers storing current data
buffered_count: usize
Implementations§
source§impl DataChunkBuilder
impl DataChunkBuilder
pub fn new(data_types: Vec<DataType>, batch_size: usize) -> Self
pub fn batch_size(&self) -> usize
sourcefn ensure_builders(&mut self)
fn ensure_builders(&mut self)
Lazily create the array builders if absent
sourcefn append_chunk_inner(
&mut self,
input_chunk: SlicedDataChunk,
) -> (Option<SlicedDataChunk>, Option<DataChunk>)
fn append_chunk_inner( &mut self, input_chunk: SlicedDataChunk, ) -> (Option<SlicedDataChunk>, Option<DataChunk>)
Returns not consumed input chunked data as sliced data chunk, and a data chunk of
batch_size
.
If input_chunk
is not totally consumed, it’s returned with a new offset, which is equal to
old_offset + consumed_rows
. Otherwise the first value is None
.
If number of batch_size
rows reached, it’s returned as the second value of tuple.
Otherwise it’s None
.
sourcepub fn append_chunk(&mut self, data_chunk: DataChunk) -> AppendDataChunk<'_> ⓘ
pub fn append_chunk(&mut self, data_chunk: DataChunk) -> AppendDataChunk<'_> ⓘ
Returns an iterator that yields data chunks during appending the whole input data chunk. The iterator must be fully consumed to ensure all data is appended.
sourcepub fn consume_all(&mut self) -> Option<DataChunk>
pub fn consume_all(&mut self) -> Option<DataChunk>
Returns all data in current buffer.
If buffered_count
is 0, None
is returned.
fn append_one_row_internal(&mut self, data_chunk: &DataChunk, row_idx: usize)
fn do_append_one_row_from_datums( &mut self, datums: impl Iterator<Item = impl ToDatumRef>, )
sourcepub fn append_one_row(&mut self, row: impl Row) -> Option<DataChunk>
pub fn append_one_row(&mut self, row: impl Row) -> Option<DataChunk>
Append one row from the given Row
.
Return a data chunk if the buffer is full after append one row. Otherwise None
.
fn append_one_row_no_finish(&mut self, row: impl Row)
sourcepub fn append_one_row_from_array_elements<'a, I1, I2>(
&mut self,
left_arrays: I1,
left_row_id: usize,
right_arrays: I2,
right_row_id: usize,
) -> Option<DataChunk>
pub fn append_one_row_from_array_elements<'a, I1, I2>( &mut self, left_arrays: I1, left_row_id: usize, right_arrays: I2, right_row_id: usize, ) -> Option<DataChunk>
Append one row from the given two arrays.
Return a data chunk if the buffer is full after append one row. Otherwise None
.
fn build_data_chunk(&mut self) -> DataChunk
pub fn buffered_count(&self) -> usize
pub fn can_append(&self, count: usize) -> bool
pub fn num_columns(&self) -> usize
pub fn data_types(&self) -> Vec<DataType>
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataChunkBuilder
impl RefUnwindSafe for DataChunkBuilder
impl Send for DataChunkBuilder
impl Sync for DataChunkBuilder
impl Unpin for DataChunkBuilder
impl UnwindSafe for DataChunkBuilder
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.