pub struct SingleRowListArrayBuilder { /* private fields */ }
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);
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
Trait Implementations§
Source§impl Clone for SingleRowListArrayBuilder
impl Clone for SingleRowListArrayBuilder
Source§fn clone(&self) -> SingleRowListArrayBuilder
fn clone(&self) -> SingleRowListArrayBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more