Struct arrow::array::ArrayData

source ·
pub struct ArrayData { /* private fields */ }
Expand description

An generic representation of Arrow array data which encapsulates common attributes and operations for Arrow array. Specific operations for different arrays types (e.g., primitive, list, struct) are implemented in Array.

Implementations§

Create a new ArrayData instance;

If null_count is not specified, the number of nulls in null_bit_buffer is calculated.

If the number of nulls is 0 then the null_bit_buffer is set to None.

Safety

The input values must form a valid Arrow array for data_type, or undefined behavior can result.

Note: This is a low level API and most users of the arrow crate should create arrays using the methods in the array module.

Create a new ArrayData, validating that the provided buffers form a valid Arrow array of the specified data type.

If the number of nulls in null_bit_buffer is 0 then the null_bit_buffer is set to None.

Internally this calls through to Self::validate_data

Note: This is a low level API and most users of the arrow crate should create arrays using the builders found in arrow_array

Returns a builder to construct a ArrayData instance.

Returns a reference to the data type of this array data

Returns a slice of buffers for this array data

Returns a slice of children data arrays

Returns whether the element at index i is null

Returns a reference to the null bitmap of this array data

Returns a reference to the null buffer of this array data.

Returns whether the element at index i is not null

Returns the length (i.e., number of elements) of this array

Returns the offset of this array

Returns the total number of nulls in this array

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

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

Creates a zero-copy slice of itself. This creates a new ArrayData with a different offset, len and a shifted null bitmap.

Panics

Panics if offset + length > self.len().

Returns the buffer as a slice of type T starting at self.offset

Panics

This function panics if:

  • the buffer is not byte-aligned with type T, or
  • the datatype is Boolean (it corresponds to a bit-packed buffer where the offset is not applicable)

Returns a new empty ArrayData valid for data_type.

“cheap” validation of an ArrayData. Ensures buffers are sufficiently sized to store len + offset total elements of data_type and performs other inexpensive consistency checks.

This check is “cheap” in the sense that it does not validate the contents of the buffers (e.g. that all offsets for UTF8 arrays are within the bounds of the values buffer).

See ArrayData::validate_data to validate fully the offset content and the validity of utf8 data

Validate that the data contained within this ArrayData is valid

  1. Null count is correct
  2. All offsets are valid
  3. All String data is valid UTF-8
  4. All dictionary offsets are valid

Internally this calls:

Note: this does not recurse into children, for a recursive variant see Self::validate_full

Performs a full recursive validation of this ArrayData and all its children

This is equivalent to calling Self::validate_data on this ArrayData and all its children recursively

Validates the values stored within this ArrayData are valid without recursing into child ArrayData

Does not (yet) check

  1. Union type_ids are valid see #85 Validates the the null count is correct and that any nullability requirements of its children are correct

Validates the values stored within this ArrayData are valid without recursing into child ArrayData

Does not (yet) check

  1. Union type_ids are valid see #85

Returns true if this ArrayData is equal to other, using pointer comparisons to determine buffer equality. This is cheaper than PartialEq::eq but may return false when the arrays are logically equal

Converts this ArrayData into an ArrayDataBuilder

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Constructs a DictionaryArray from an array data reference.

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Constructs a PrimitiveArray from an array data reference.

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.