Struct arrow_data::transform::MutableArrayData
source · pub struct MutableArrayData<'a> { /* private fields */ }
Expand description
Implementations§
source§impl<'a> MutableArrayData<'a>
impl<'a> MutableArrayData<'a>
sourcepub fn new(arrays: Vec<&'a ArrayData>, use_nulls: bool, capacity: usize) -> Self
pub fn new(arrays: Vec<&'a ArrayData>, use_nulls: bool, capacity: usize) -> Self
returns a new MutableArrayData with capacity to capacity
slots and specialized to create an
ArrayData from multiple arrays
.
use_nulls
is a flag used to optimize insertions. It should be false
if the only source of nulls
are the arrays themselves and true
if the user plans to call MutableArrayData::extend_nulls.
In other words, if use_nulls
is false
, calling MutableArrayData::extend_nulls should not be used.
sourcepub fn with_capacities(
arrays: Vec<&'a ArrayData>,
use_nulls: bool,
capacities: Capacities
) -> Self
pub fn with_capacities( arrays: Vec<&'a ArrayData>, use_nulls: bool, capacities: Capacities ) -> Self
Similar to MutableArrayData::new, but lets users define the preallocated capacities of the array. See also MutableArrayData::new for more information on the arguments.
Panic
This function panics if the given capacities
don’t match the data type of arrays
. Or when
a Capacities variant is not yet supported.
sourcepub fn extend(&mut self, index: usize, start: usize, end: usize)
pub fn extend(&mut self, index: usize, start: usize, end: usize)
Extends this array with a chunk of its source arrays
Arguments
index
- the index of array that you what to copy values fromstart
- the start index of the chunk (inclusive)end
- the end index of the chunk (exclusive)
Panic
This function panics if there is an invalid index,
i.e. index
>= the number of source arrays
or end
> the length of the index
th array
sourcepub fn extend_nulls(&mut self, len: usize)
pub fn extend_nulls(&mut self, len: usize)
Extends this MutableArrayData with null elements, disregarding the bound arrays
Panics
Panics if MutableArrayData
not created with use_nulls
or nullable source arrays
sourcepub fn null_count(&self) -> usize
pub fn null_count(&self) -> usize
Returns the current null count
sourcepub fn freeze(self) -> ArrayData
pub fn freeze(self) -> ArrayData
Creates a ArrayData from the pushed regions up to this point, consuming self
.
sourcepub fn into_builder(self) -> ArrayDataBuilder
pub fn into_builder(self) -> ArrayDataBuilder
Creates a ArrayDataBuilder from the pushed regions up to this point, consuming self
.
This is useful for extending the default behavior of MutableArrayData.