Struct arrow::array::MutableArrayData [−][src]
pub struct MutableArrayData<'a> { /* fields omitted */ }
Expand description
Struct to efficiently and interactively create an ArrayData from an existing ArrayData by
copying chunks.
The main use case of this struct is to perform unary operations to arrays of arbitrary types, such as filter
and take
.
Example:
use arrow::{array::{Int32Array, Array, MutableArrayData}}; let array = Int32Array::from(vec![1, 2, 3, 4, 5]); let array = array.data(); // Create a new `MutableArrayData` from an array and with a capacity of 4. // Capacity here is equivalent to `Vec::with_capacity` let arrays = vec![array]; let mut mutable = MutableArrayData::new(arrays, false, 4); mutable.extend(0, 1, 3); // extend from the slice [1..3], [2,3] mutable.extend(0, 0, 3); // extend from the slice [0..3], [1,2,3] // `.freeze()` to convert `MutableArrayData` into a `ArrayData`. let new_array = Int32Array::from(mutable.freeze()); assert_eq!(Int32Array::from(vec![2, 3, 1, 2, 3]), new_array);
Implementations
impl<'a> MutableArrayData<'a>
[src]
impl<'a> MutableArrayData<'a>
[src]pub fn new(arrays: Vec<&'a ArrayData>, use_nulls: bool, capacity: usize) -> Self
[src]
pub fn new(arrays: Vec<&'a ArrayData>, use_nulls: bool, capacity: usize) -> Self
[src]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.
pub fn extend(&mut self, index: usize, start: usize, end: usize)
[src]
pub fn extend(&mut self, index: usize, start: usize, end: usize)
[src]Extends this MutableArrayData with elements from the bounded ArrayData at start
and for a size of len
.
Panic
This function panics if the range is out of bounds, i.e. if start + len >= array.len()
.
pub fn extend_nulls(&mut self, len: usize)
[src]
pub fn extend_nulls(&mut self, len: usize)
[src]Extends this MutableArrayData with null elements, disregarding the bound arrays
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for MutableArrayData<'a>
impl<'a> !Send for MutableArrayData<'a>
impl<'a> !Sync for MutableArrayData<'a>
impl<'a> Unpin for MutableArrayData<'a>
impl<'a> !UnwindSafe for MutableArrayData<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,