[][src]Struct arrow::array::UnionArray

pub struct UnionArray { /* fields omitted */ }

An Array that can represent slots of varying types

Implementations

impl UnionArray[src]

pub fn new(
    type_ids: Buffer,
    value_offsets: Option<Buffer>,
    child_arrays: Vec<(Field, ArrayRef)>,
    bitmap_data: Option<(Buffer, usize)>
) -> Self
[src]

Creates a new UnionArray.

Accepts type ids, child arrays and optionally offsets (for dense unions) to create a new UnionArray. This method makes no attempt to validate the data provided by the caller and assumes that each of the components are correct and consistent with each other. See try_new for an alternative that validates the data provided.

Data Consistency

The type_ids Buffer should contain i8 values. These values should be greater than zero and must be less than the number of children provided in child_arrays. These values are used to index into the child_arrays.

The value_offsets Buffer is only provided in the case of a dense union, sparse unions should use None. If provided the value_offsets Buffer should contain i32 values. These values should be greater than zero and must be less than the length of the overall array.

In both cases above we use signed integer types to maintain compatibility with other Arrow implementations.

In both of the cases above we are accepting Buffer's which are assumed to be representing i8 and i32 values respectively. Buffer objects are untyped and no attempt is made to ensure that the data provided is valid.

pub fn try_new(
    type_ids: Buffer,
    value_offsets: Option<Buffer>,
    child_arrays: Vec<(Field, ArrayRef)>,
    bitmap: Option<Buffer>
) -> Result<Self>
[src]

Attempts to create a new UnionArray and validates the inputs provided.

pub fn child(&self, type_id: i8) -> ArrayRef[src]

Accesses the child array for type_id.

Panics

Panics if the type_id provided is less than zero or greater than the number of types in the Union.

pub fn type_id(&self, index: usize) -> i8[src]

Returns the type_id for the array slot at index.

Panics

Panics if index is greater than the length of the array.

pub fn value_offset(&self, index: usize) -> i32[src]

Returns the offset into the underlying values array for the array slot at index.

Panics

Panics if index is greater than the length of the array.

pub fn value(&self, index: usize) -> ArrayRef[src]

Returns the array's value at index.

Panics

Panics if index is greater than the length of the array.

pub fn type_names(&self) -> Vec<&str>[src]

Returns the names of the types in the union.

Trait Implementations

impl Array for UnionArray[src]

fn get_buffer_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied by the buffers owned by this UnionArray.

fn get_array_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied physically by this UnionArray.

impl ArrayEqual for UnionArray[src]

impl Debug for UnionArray[src]

impl From<Arc<ArrayData>> for UnionArray[src]

impl JsonEqual for UnionArray[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

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

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

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

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.

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.

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