pub struct SingleRowListArrayBuilder {
arr: ArrayRef,
nullable: bool,
field_name: Option<String>,
}Expand description
Creates single element [ListArray], [LargeListArray] and
[FixedSizeListArray] from other arrays
For example this builder can convert [1, 2, 3] into [[1, 2, 3]]
§Example
// Array is [1, 2, 3]
let arr = ListArray::from_iter_primitive::<Int64Type, _, _>(vec![Some(vec![
Some(1),
Some(2),
Some(3),
])]);
// Wrap as a list array: [[1, 2, 3]]
let list_arr = SingleRowListArrayBuilder::new(Arc::new(arr)).build_list_array();
assert_eq!(list_arr.len(), 1);Fields§
§arr: ArrayRefarray to be wrapped
nullable: boolShould the resulting array be nullable? Defaults to true.
field_name: Option<String>Specify the field name for the resulting array. Defaults to value used in
[Field::new_list_field]
Implementations§
Source§impl SingleRowListArrayBuilder
impl SingleRowListArrayBuilder
Sourcepub fn new(arr: ArrayRef) -> Self
pub fn new(arr: ArrayRef) -> Self
Create a new instance of SingleRowListArrayBuilder
Sourcepub fn with_nullable(self, nullable: bool) -> Self
pub fn with_nullable(self, nullable: bool) -> Self
Set the nullable flag
Sourcepub fn with_field_name(self, field_name: Option<String>) -> Self
pub fn with_field_name(self, field_name: Option<String>) -> Self
sets the field name for the resulting array
Sourcepub fn with_field(self, field: &Field) -> Self
pub fn with_field(self, field: &Field) -> Self
Copies field name and nullable from the specified field
Sourcepub fn build_list_array(self) -> ListArray
pub fn build_list_array(self) -> ListArray
Build a single element [ListArray]
Sourcepub fn build_list_scalar(self) -> ScalarValue
pub fn build_list_scalar(self) -> ScalarValue
Build a single element [ListArray] and wrap as ScalarValue::List
Sourcepub fn build_large_list_array(self) -> LargeListArray
pub fn build_large_list_array(self) -> LargeListArray
Build a single element [LargeListArray]
Sourcepub fn build_large_list_scalar(self) -> ScalarValue
pub fn build_large_list_scalar(self) -> ScalarValue
Build a single element [LargeListArray] and wrap as ScalarValue::LargeList
Sourcepub fn build_fixed_size_list_array(self, list_size: usize) -> FixedSizeListArray
pub fn build_fixed_size_list_array(self, list_size: usize) -> FixedSizeListArray
Build a single element [FixedSizeListArray]
Sourcepub fn build_fixed_size_list_scalar(self, list_size: usize) -> ScalarValue
pub fn build_fixed_size_list_scalar(self, list_size: usize) -> ScalarValue
Build a single element [FixedSizeListArray] and wrap as ScalarValue::FixedSizeList
Sourcefn into_field_and_arr(self) -> (Arc<Field>, ArrayRef)
fn into_field_and_arr(self) -> (Arc<Field>, ArrayRef)
Helper function: convert this builder into a tuple of field and array
Trait Implementations§
Source§impl Clone for SingleRowListArrayBuilder
impl Clone for SingleRowListArrayBuilder
Source§fn clone(&self) -> SingleRowListArrayBuilder
fn clone(&self) -> SingleRowListArrayBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SingleRowListArrayBuilder
impl !RefUnwindSafe for SingleRowListArrayBuilder
impl Send for SingleRowListArrayBuilder
impl Sync for SingleRowListArrayBuilder
impl Unpin for SingleRowListArrayBuilder
impl !UnwindSafe for SingleRowListArrayBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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