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§
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
fn dtype(&self) -> &DType
fn len(&self) -> usize
Sourcefn append_zeros(&mut self, n: usize)
fn append_zeros(&mut self, n: usize)
Appends n “zero” values to the array.
Zero values are generally determined by Scalar::default_value
.
Sourceunsafe fn append_nulls_unchecked(&mut self, n: usize)
unsafe fn append_nulls_unchecked(&mut self, n: usize)
Sourceunsafe fn extend_from_array_unchecked(&mut self, array: &dyn Array)
unsafe fn extend_from_array_unchecked(&mut self, array: &dyn Array)
Sourcefn ensure_capacity(&mut self, capacity: usize)
fn ensure_capacity(&mut self, capacity: usize)
Ensure that the builder can hold at least capacity
number of items
Sourcefn set_validity(&mut self, validity: Mask)
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.
Sourcefn finish(&mut self) -> ArrayRef
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§
fn is_empty(&self) -> bool
Sourcefn append_zero(&mut self)
fn append_zero(&mut self)
Append a “zero” value to the array.
Zero values are generally determined by Scalar::default_value
.
Sourcefn append_null(&mut self)
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
.
Sourcefn append_nulls(&mut self, n: usize)
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
.
Sourcefn append_default(&mut self)
fn append_default(&mut self)
Appends a default value to the array.
Sourcefn append_defaults(&mut self, n: usize)
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)
.
Sourcefn append_scalar(&mut self, scalar: &Scalar) -> VortexResult<()>
fn append_scalar(&mut self, scalar: &Scalar) -> VortexResult<()>
A generic function to append a scalar to the builder.