ArrayBuilder

Trait ArrayBuilder 

Source
pub trait ArrayBuilder: Send {
Show 19 methods // Required methods fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn dtype(&self) -> &DType; fn len(&self) -> usize; fn append_zeros(&mut self, n: usize); unsafe fn append_nulls_unchecked(&mut self, n: usize); unsafe fn extend_from_array_unchecked(&mut self, array: &dyn Array); fn ensure_capacity(&mut self, capacity: usize); fn set_validity(&mut self, validity: Mask); fn finish(&mut self) -> ArrayRef; // Provided methods fn is_empty(&self) -> bool { ... } fn append_zero(&mut self) { ... } fn append_null(&mut self) { ... } fn append_nulls(&mut self, n: usize) { ... } fn append_default(&mut self) { ... } fn append_defaults(&mut self, n: usize) { ... } fn append_scalar(&mut self, scalar: &Scalar) -> VortexResult<()> { ... } fn extend_from_array(&mut self, array: &dyn Array) { ... } fn finish_into_canonical(&mut self) -> Canonical { ... }
}

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Source

fn dtype(&self) -> &DType

Source

fn len(&self) -> usize

Source

fn append_zeros(&mut self, n: usize)

Appends n “zero” values to the array.

Zero values are generally determined by Scalar::default_value.

Source

unsafe fn append_nulls_unchecked(&mut self, n: usize)

The inner part of append_nulls.

§Safety

The array builder must be nullable.

Source

unsafe fn extend_from_array_unchecked(&mut self, array: &dyn Array)

The inner part of extend_from_array.

§Safety

The array that must have an equal DType to the array builder’s DType (with nullability superset semantics).

Source

fn ensure_capacity(&mut self, capacity: usize)

Ensure that the builder can hold at least capacity number of items

Source

fn set_validity(&mut self, validity: Mask)

Override builders validity with the one provided.

Note that this will have no effect on the final array if the array builder is non-nullable.

Source

fn finish(&mut self) -> ArrayRef

Constructs an Array from the builder components.

§Panics

This function may panic if the builder’s methods are called with invalid arguments. If only the methods on this interface are used, the builder should not panic. However, specific builders have interfaces that may be misused. For example, if the number of values in a PrimitiveBuilder’s vortex_buffer::BufferMut does not match the number of validity bits, the PrimitiveBuilder’s Self::finish will panic.

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn append_zero(&mut self)

Append a “zero” value to the array.

Zero values are generally determined by Scalar::default_value.

Source

fn append_null(&mut self)

Append a “null” value to the array.

Implementors should panic if this method is called on a non-nullable ArrayBuilder.

Source

fn append_nulls(&mut self, n: usize)

Appends n “null” values to the array.

Implementors should panic if this method is called on a non-nullable ArrayBuilder.

Source

fn append_default(&mut self)

Appends a default value to the array.

Source

fn append_defaults(&mut self, n: usize)

Appends n default values to the array.

If the array builder is nullable, then this has the behavior of self.append_nulls(n). If the array builder is non-nullable, then it has the behavior of self.append_zeros(n).

Source

fn append_scalar(&mut self, scalar: &Scalar) -> VortexResult<()>

A generic function to append a scalar to the builder.

Source

fn extend_from_array(&mut self, array: &dyn Array)

Extends the array with the provided array, canonicalizing if necessary.

Implementors must validate that the passed in Array has the correct DType.

Source

fn finish_into_canonical(&mut self) -> Canonical

Constructs a canonical array directly from the builder.

This method provides a default implementation that creates an ArrayRef via finish and then converts it to canonical form. Specific builders can override this with optimized implementations that avoid the intermediate Array creation.

Implementors§