polars_arrow::array

Trait Array

Source
pub trait Array:
    Send
    + Sync
    + DynClone
    + 'static {
Show 19 methods // Required methods fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn len(&self) -> usize; fn dtype(&self) -> &ArrowDataType; fn validity(&self) -> Option<&Bitmap>; fn split_at_boxed(&self, offset: usize) -> (Box<dyn Array>, Box<dyn Array>); unsafe fn split_at_boxed_unchecked( &self, offset: usize, ) -> (Box<dyn Array>, Box<dyn Array>); fn slice(&mut self, offset: usize, length: usize); unsafe fn slice_unchecked(&mut self, offset: usize, length: usize); fn with_validity(&self, validity: Option<Bitmap>) -> Box<dyn Array>; fn to_boxed(&self) -> Box<dyn Array>; // Provided methods fn is_empty(&self) -> bool { ... } fn null_count(&self) -> usize { ... } fn has_nulls(&self) -> bool { ... } fn is_null(&self, i: usize) -> bool { ... } unsafe fn is_null_unchecked(&self, i: usize) -> bool { ... } fn is_valid(&self, i: usize) -> bool { ... } fn sliced(&self, offset: usize, length: usize) -> Box<dyn Array> { ... } unsafe fn sliced_unchecked( &self, offset: usize, length: usize, ) -> Box<dyn Array> { ... }
}
Expand description

A trait representing an immutable Arrow array. Arrow arrays are trait objects that are infallibly downcasted to concrete types according to the Array::dtype.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Converts itself to a reference of Any, which enables downcasting to concrete types.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Converts itself to a mutable reference of Any, which enables mutable downcasting to concrete types.

Source

fn len(&self) -> usize

The length of the Array. Every array has a length corresponding to the number of elements (slots).

Source

fn dtype(&self) -> &ArrowDataType

The ArrowDataType of the Array. In combination with Array::as_any, this can be used to downcast trait objects (dyn Array) to concrete arrays.

Source

fn validity(&self) -> Option<&Bitmap>

The validity of the Array: every array has an optional Bitmap that, when available specifies whether the array slot is valid or not (null). When the validity is None, all slots are valid.

Source

fn split_at_boxed(&self, offset: usize) -> (Box<dyn Array>, Box<dyn Array>)

Split Self at offset into two boxed Arrays where offset <= self.len().

Source

unsafe fn split_at_boxed_unchecked( &self, offset: usize, ) -> (Box<dyn Array>, Box<dyn Array>)

Split Self at offset into two boxed Arrays without checking offset <= self.len().

§Safety

Safe if offset <= self.len().

Source

fn slice(&mut self, offset: usize, length: usize)

Slices this Array.

§Implementation

This operation is O(1) over len.

§Panic

This function panics iff offset + length > self.len().

Source

unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)

Slices the Array.

§Implementation

This operation is O(1).

§Safety

The caller must ensure that offset + length <= self.len()

Source

fn with_validity(&self, validity: Option<Bitmap>) -> Box<dyn Array>

Clones this Array with a new assigned bitmap.

§Panic

This function panics iff validity.len() != self.len().

Source

fn to_boxed(&self) -> Box<dyn Array>

Clone a &dyn Array to an owned Box<dyn Array>.

Provided Methods§

Source

fn is_empty(&self) -> bool

whether the array is empty

Source

fn null_count(&self) -> usize

The number of null slots on this Array.

§Implementation

This is O(1) since the number of null elements is pre-computed.

Source

fn has_nulls(&self) -> bool

Source

fn is_null(&self, i: usize) -> bool

Returns whether slot i is null.

§Panic

Panics iff i >= self.len().

Source

unsafe fn is_null_unchecked(&self, i: usize) -> bool

Returns whether slot i is null.

§Safety

The caller must ensure i < self.len()

Source

fn is_valid(&self, i: usize) -> bool

Returns whether slot i is valid.

§Panic

Panics iff i >= self.len().

Source

fn sliced(&self, offset: usize, length: usize) -> Box<dyn Array>

Returns a slice of this Array.

§Implementation

This operation is O(1) over len.

§Panic

This function panics iff offset + length > self.len().

Source

unsafe fn sliced_unchecked( &self, offset: usize, length: usize, ) -> Box<dyn Array>

Returns a slice of this Array.

§Implementation

This operation is O(1) over len, as it amounts to increase two ref counts and moving the struct to the heap.

§Safety

The caller must ensure that offset + length <= self.len()

Trait Implementations§

Source§

impl<'a> AsRef<dyn Array + 'a> for dyn Array

Source§

fn as_ref(&self) -> &(dyn Array + 'a)

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for dyn Array + '_

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<O: Offset> PartialEq<&(dyn Array + 'static)> for BinaryArray<O>

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for BooleanArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K: DictionaryKey> PartialEq<&(dyn Array + 'static)> for DictionaryArray<K>

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for FixedSizeBinaryArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for FixedSizeListArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Offset> PartialEq<&(dyn Array + 'static)> for ListArray<O>

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for MapArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for NullArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: NativeType> PartialEq<&(dyn Array + 'static)> for PrimitiveArray<T>

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for StructArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Array + 'static)> for UnionArray

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Offset> PartialEq<&(dyn Array + 'static)> for Utf8Array<O>

Source§

fn eq(&self, other: &&dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Offset> PartialEq<BinaryArray<O>> for &dyn Array

Source§

fn eq(&self, other: &BinaryArray<O>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: NativeType> PartialEq<PrimitiveArray<T>> for &dyn Array

Source§

fn eq(&self, other: &PrimitiveArray<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Offset> PartialEq<Utf8Array<O>> for &dyn Array

Source§

fn eq(&self, other: &Utf8Array<O>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<dyn Array> for Arc<dyn Array + '_>

Source§

fn eq(&self, that: &dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<dyn Array> for Box<dyn Array + '_>

Source§

fn eq(&self, that: &dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for dyn Array + '_

Source§

fn eq(&self, that: &dyn Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TotalEq for Box<dyn Array>

Source§

fn tot_eq(&self, other: &Self) -> bool

Source§

fn tot_ne(&self, other: &Self) -> bool

Implementors§