pub struct FixedSizeListBuilder<T: ArrayBuilder> { /* private fields */ }
Expand description

Array builder for FixedSizeListArray

use arrow_array::{builder::{Int32Builder, FixedSizeListBuilder}, Array, Int32Array};
let values_builder = Int32Builder::new();
let mut builder = FixedSizeListBuilder::new(values_builder, 3);

//  [[0, 1, 2], null, [3, null, 5], [6, 7, null]]
builder.values().append_value(0);
builder.values().append_value(1);
builder.values().append_value(2);
builder.append(true);
builder.values().append_null();
builder.values().append_null();
builder.values().append_null();
builder.append(false);
builder.values().append_value(3);
builder.values().append_null();
builder.values().append_value(5);
builder.append(true);
builder.values().append_value(6);
builder.values().append_value(7);
builder.values().append_null();
builder.append(true);
let list_array = builder.finish();
assert_eq!(
    *list_array.value(0),
    Int32Array::from(vec![Some(0), Some(1), Some(2)])
);
assert!(list_array.is_null(1));
assert_eq!(
    *list_array.value(2),
    Int32Array::from(vec![Some(3), None, Some(5)])
);
assert_eq!(
    *list_array.value(3),
    Int32Array::from(vec![Some(6), Some(7), None])
)

Implementations§

Creates a new FixedSizeListBuilder from a given values array builder value_length is the number of values within each array

Creates a new FixedSizeListBuilder from a given values array builder value_length is the number of values within each array capacity is the number of items to pre-allocate space for in this builder

Returns the child array builder as a mutable reference.

This mutable reference can be used to append values into the child array builder, but you must call append to delimit each distinct list value.

Returns the length of the list

Finish the current fixed-length list array slot

Builds the FixedSizeListBuilder and reset this builder.

Builds the FixedSizeListBuilder without resetting the builder.

Trait Implementations§

Returns the builder as a non-mutable Any reference.

Returns the builder as a mutable Any reference.

Returns the boxed builder as a box of Any.

Returns the number of array slots in the builder

Returns whether the number of array slots is zero

Builds the array and reset this builder.

Builds the array without resetting the builder.

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.