Skip to main content

ArrowArray

Struct ArrowArray 

Source
pub struct ArrowArray(/* private fields */);
Expand description

An owned Arrow C Data Interface array.

Released on drop, unless it was already released, moved out with into_raw, or handed to data_chunk_from_arrow — which is why that function takes it by value.

As with ArrowSchema, every accessor returns a neutral value once is_released is true: the specification leaves the other fields undefined after release.

Implementations§

Source§

impl ArrowArray

Source

pub const fn empty() -> Self

An unfilled record, ready for a producer to write into.

Source

pub const unsafe fn from_raw(raw: RawArrowArray) -> Self

Takes ownership of a filled ABI record.

§Safety
  • raw must be a record whose release callback this value may call exactly once, and no other wrapper may hold the same record.
  • It must be a valid Arrow C Data Interface array: length, offset and null_count true, and every buffer, child and dictionary pointer valid for the lengths and offsets the record and its descendants declare. The safe accessors here and data_chunk_from_arrow read through those pointers; the Arrow C Data Interface carries no sizes that could be checked instead.
Source

pub const unsafe fn take_from(ptr: *mut RawArrowArray) -> Self

Moves the record out of ptr, leaving a released placeholder behind.

See ArrowSchema::take_from.

§Safety
  • ptr must be valid for reads and writes and properly aligned for RawArrowArray.
  • The caller must not use the record behind ptr afterwards.
  • The record behind ptr must meet from_raw’s contract: this value calls its release callback, and the safe accessors and data_chunk_from_arrow read through its pointers.
Source

pub fn into_raw(self) -> RawArrowArray

Relinquishes ownership, returning the ABI record.

The caller becomes responsible for calling release on it.

Source

pub const fn as_ptr(&self) -> *const RawArrowArray

A pointer to the ABI record, for C APIs that read it.

Source

pub const fn as_mut_ptr(&mut self) -> *mut RawArrowArray

A mutable pointer to the ABI record, for C APIs that fill it.

Source

pub const fn is_released(&self) -> bool

Whether release is null — either never filled, or already released.

Source

pub fn release(&mut self)

Releases the array now instead of at drop. Idempotent.

Source

pub fn len(&self) -> usize

Number of rows. 0 once released.

Source

pub fn is_empty(&self) -> bool

Whether the array carries no rows.

Source

pub const fn null_count(&self) -> i64

Number of null entries, or -1 when the producer did not compute it.

Source

pub const fn offset(&self) -> i64

Logical offset into the buffers.

Source

pub fn child_count(&self) -> usize

Number of child arrays — the column count, for the struct array a converted DuckDB chunk produces. 0 once released.

Source

pub fn child(&self, index: usize) -> Option<&Self>

Borrows child array index.

Children are owned by this array’s producer and released with it.

Trait Implementations§

Source§

impl Debug for ArrowArray

Source§

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

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

impl Drop for ArrowArray

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.