Struct InProgressByteViewArray

Source
pub(crate) struct InProgressByteViewArray<B: ByteViewType> {
    source: Option<Source>,
    batch_size: usize,
    views: Vec<u128>,
    nulls: NullBufferBuilder,
    current: Option<Vec<u8>>,
    completed: Vec<Buffer>,
    buffer_source: BufferSource,
    _phantom: PhantomData<B>,
}
Expand description

InProgressArray for StringViewArray and BinaryViewArray

This structure buffers the views and data buffers as they are copied from the source array, and then produces a new array when finish is called. It also handles “garbage collection” by copying strings to a new buffer when the source buffer is sparse (i.e. uses at least 2x more than the memory it needs).

Fields§

§source: Option<Source>

The source array and information

§batch_size: usize

the target batch size (and thus size for views allocation)

§views: Vec<u128>

The in progress views

§nulls: NullBufferBuilder

In progress nulls

§current: Option<Vec<u8>>

current buffer

§completed: Vec<Buffer>

completed buffers

§buffer_source: BufferSource

Allocates new buffers of increasing size as needed

§_phantom: PhantomData<B>

Phantom so we can use the same struct for both StringViewArray and BinaryViewArray

Implementations§

Source§

impl<B: ByteViewType> InProgressByteViewArray<B>

Source

pub(crate) fn new(batch_size: usize) -> Self

Source

fn ensure_capacity(&mut self)

Allocate space for output views and nulls if needed

This is done on write (when we know it is necessary) rather than eagerly to avoid allocations that are not used.

Source

fn finish_current(&mut self)

Finishes in progress buffer, if any

Source

fn append_views_and_update_buffer_index( &mut self, views: &[u128], buffers: &[Buffer], )

Append views to self.views, updating the buffer index if necessary

Source

fn append_views_and_copy_strings( &mut self, views: &[u128], view_buffer_size: usize, buffers: &[Buffer], )

Append views to self.views, copying data from the buffers into self.buffers and updating the buffer index as necessary.

§Arguments
  • views - the views to append
  • view_buffer_size - the total number of bytes pointed to by all views (used to allocate new buffers if needed)
  • buffers - the buffers the reviews point to
Source

fn append_views_and_copy_strings_inner( &mut self, views: &[u128], dst_buffer: Vec<u8>, buffers: &[Buffer], )

Append views to self.views, copying data from the buffers into dst_buffer, which is then set as self.current

§Panics:

If self.current is Some

See append_views_and_copy_strings for more details

Trait Implementations§

Source§

impl<B: ByteViewType> Debug for InProgressByteViewArray<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: ByteViewType> InProgressArray for InProgressByteViewArray<B>

Source§

fn set_source(&mut self, source: Option<ArrayRef>)

Set the source array. Read more
Source§

fn copy_rows(&mut self, offset: usize, len: usize) -> Result<(), ArrowError>

Copy rows from the current source array into the in-progress array Read more
Source§

fn finish(&mut self) -> Result<ArrayRef, ArrowError>

Finish the currently in-progress array and return it as an ArrayRef

Auto Trait Implementations§

Blanket Implementations§

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.