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]

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]

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]

Extends this MutableArrayData with null elements, disregarding the bound arrays

pub fn freeze(self) -> ArrayData[src]

Creates a ArrayData from the pushed regions up to this point, consuming self.

Trait Implementations

impl<'a> Debug for MutableArrayData<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V