pub struct ByteViewGroupValueBuilder<B: ByteViewType> {
views: Vec<u128>,
in_progress: Vec<u8>,
completed: Vec<Buffer>,
max_block_size: usize,
nulls: MaybeNullBufferBuilder,
_phantom: PhantomData<B>,
}Expand description
An implementation of GroupColumn for binary view and utf8 view types.
Stores a collection of binary view or utf8 view group values in a buffer
whose structure is similar to GenericByteViewArray, and we can get benefits:
- Efficient comparison of incoming rows to existing rows
- Efficient construction of the final output array
- Efficient to perform
take_ncomparing to useGenericByteViewBuilder
Fields§
§views: Vec<u128>The views of string values
If string len <= 12, the view’s format will be: string(12B) | len(4B)
If string len > 12, its format will be: offset(4B) | buffer_index(4B) | prefix(4B) | len(4B)
in_progress: Vec<u8>The progressing block
New values will be inserted into it until its capacity
is not enough(detail can see max_block_size).
completed: Vec<Buffer>The completed blocks
max_block_size: usizeThe max size of in_progress
in_progress will be flushed into completed, and create new in_progress
when found its remaining capacity(max_block_size - len(in_progress)),
is no enough to store the appended value.
Currently it is fixed at 2MB.
nulls: MaybeNullBufferBuilderNulls
_phantom: PhantomData<B>phantom data so the type requires <B>
Implementations§
Source§impl<B: ByteViewType> ByteViewGroupValueBuilder<B>
impl<B: ByteViewType> ByteViewGroupValueBuilder<B>
pub fn new() -> Self
Sourcefn with_max_block_size(self, max_block_size: usize) -> Self
fn with_max_block_size(self, max_block_size: usize) -> Self
Set the max block size
fn equal_to_inner( &self, lhs_row: usize, array: &ArrayRef, rhs_row: usize, ) -> bool
fn append_val_inner(&mut self, array: &ArrayRef, row: usize)
fn vectorized_equal_to_inner( &self, lhs_rows: &[usize], array: &ArrayRef, rhs_rows: &[usize], equal_to_results: &mut [bool], )
fn vectorized_append_inner(&mut self, array: &ArrayRef, rows: &[usize])
fn do_append_val_inner(&mut self, array: &GenericByteViewArray<B>, row: usize)where
B: ByteViewType,
fn ensure_in_progress_big_enough(&mut self, value_len: usize)
fn do_equal_to_inner( &self, lhs_row: usize, array: &GenericByteViewArray<B>, rhs_row: usize, ) -> bool
fn value(&self, buffer_index: usize, offset: usize, length: usize) -> &[u8] ⓘ
fn build_inner(self) -> ArrayRef
fn take_n_inner(&mut self, n: usize) -> ArrayRef
fn take_buffers_with_whole_last( &mut self, last_remaining_buffer_index: usize, ) -> Vec<Buffer>
fn take_buffers_with_partial_last( &mut self, last_remaining_buffer_index: usize, last_take_len: usize, ) -> Vec<Buffer>
fn should_take_whole_buffer(&self, buffer_index: usize, take_len: usize) -> bool
fn flush_in_progress(&mut self)
Trait Implementations§
Source§impl<B: ByteViewType> Default for ByteViewGroupValueBuilder<B>
impl<B: ByteViewType> Default for ByteViewGroupValueBuilder<B>
Source§impl<B: ByteViewType> GroupColumn for ByteViewGroupValueBuilder<B>
impl<B: ByteViewType> GroupColumn for ByteViewGroupValueBuilder<B>
Source§fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool
fn equal_to(&self, lhs_row: usize, array: &ArrayRef, rhs_row: usize) -> bool
lhs_row is equal to
the row in array at rhs_row Read moreSource§fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()>
fn append_val(&mut self, array: &ArrayRef, row: usize) -> Result<()>
row in array to this builderSource§fn vectorized_equal_to(
&self,
group_indices: &[usize],
array: &ArrayRef,
rows: &[usize],
equal_to_results: &mut [bool],
)
fn vectorized_equal_to( &self, group_indices: &[usize], array: &ArrayRef, rows: &[usize], equal_to_results: &mut [bool], )
Source§fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()>
fn vectorized_append(&mut self, array: &ArrayRef, rows: &[usize]) -> Result<()>
append_valSource§fn size(&self) -> usize
fn size(&self) -> usize
GroupColumnAuto Trait Implementations§
impl<B> Freeze for ByteViewGroupValueBuilder<B>
impl<B> RefUnwindSafe for ByteViewGroupValueBuilder<B>where
B: RefUnwindSafe,
impl<B> Send for ByteViewGroupValueBuilder<B>
impl<B> Sync for ByteViewGroupValueBuilder<B>
impl<B> Unpin for ByteViewGroupValueBuilder<B>where
B: Unpin,
impl<B> UnwindSafe for ByteViewGroupValueBuilder<B>where
B: UnwindSafe,
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