Trait datafusion::common::arrow::array::ArrayAccessor

source ·
pub trait ArrayAccessor: Array {
    type Item: Send + Sync;

    // Required methods
    fn value(&self, index: usize) -> Self::Item;
    unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}
Expand description

A generic trait for accessing the values of an Array

§Validity

An ArrayAccessor must always return a well-defined value for an index that is within the bounds 0..Array::len, including for null indexes where Array::is_null is true.

The value at null indexes is unspecified, and implementations must not rely on a specific value such as Default::default being returned, however, it must not be undefined

Required Associated Types§

source

type Item: Send + Sync

The Arrow type of the element being accessed.

Required Methods§

source

fn value(&self, index: usize) -> Self::Item

Returns the element at index i

§Panics

Panics if the value is outside the bounds of the array

source

unsafe fn value_unchecked(&self, index: usize) -> Self::Item

Returns the element at index i

§Safety

Caller is responsible for ensuring that the index is within the bounds of the array

Implementors§