Struct arrow_data::transform::MutableArrayData

source ·
pub struct MutableArrayData<'a> { /* private fields */ }
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.

Implementations§

source§

impl<'a> MutableArrayData<'a>

source

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.

source

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.

source

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 from
  • start - 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 indexth array

source

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

source

pub fn len(&self) -> usize

Returns the current length

source

pub fn is_empty(&self) -> bool

Returns true if len is 0

source

pub fn null_count(&self) -> usize

Returns the current null count

source

pub fn freeze(self) -> ArrayData

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

source

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.

Trait Implementations§

source§

impl<'a> Debug for MutableArrayData<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MutableArrayData<'a>

§

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.