An immutable, continuous-memory numerical array implementing the Apache Arrow Primitive columnar format.
Under the hood, data is organized in two buffers:
- Data buffer (
data): a continuous binary of fixed-width numbers in little-endian. - Validity bitmap (
validity): a bitstring tracking null (nil) values (1 bit per element).
Supported Types
- Signed Integers:
:s8, :s16, :s32, :s64, :s128, :s256 - Unsigned Integers:
:u8, :u16, :u32, :u64, :u128, :u256 - Floating Point:
:f32, :f64
Notice that :s128, :u128, :s256, and :u256 are natively supported in little-endian binary format,
mapping directly to Arrow Decimal128, Decimal256, and FixedSizeBinary.
Summary
Functions
Appends a number or nil to the array.
Returns the byte size of the continuous data buffer.
Deletes the element at index idx.
Fetches the element at the given index or a slice specified by a range.
Supports negative indices (e.g. -1 for the last element).
Builds an Errow.Numeric array from a list or enumerable of numbers and optional nils.
Gets the value at index idx or returns default if out of bounds.
Finds the maximum value in the array.
Calculates the arithmetic mean (average) of the elements as a float.
Finds the minimum value in the array.
Returns a {min, max} tuple in a single pass over the array.
Creates a new empty Errow.Numeric array of the given type (defaults to :s64).
Checks if the value at the given index is null (nil).
Returns the count of null values.
Calculates the product of elements in the array. Options
Replaces the element at the given index with a new number or nil.
Returns the number of elements in the array.
Calculates the sum of elements in the array. Options
Converts the Errow.Numeric array into a standard Elixir list.
Types
@type numeric_type() ::
:s8
| :u8
| :s16
| :u16
| :s32
| :u32
| :s64
| :u64
| :s128
| :u128
| :s256
| :u256
| :f32
| :f64
@type t() :: %Errow.Numeric{ data: binary(), item_size: pos_integer(), length: non_neg_integer(), null_count: non_neg_integer(), type: numeric_type(), validity: bitstring() }
Functions
Appends a number or nil to the array.
@spec buffer_byte_size(t()) :: non_neg_integer()
Returns the byte size of the continuous data buffer.
Deletes the element at index idx.
Fetches the element at the given index or a slice specified by a range.
Supports negative indices (e.g. -1 for the last element).
@spec from_list(Enumerable.t(), numeric_type()) :: t()
Builds an Errow.Numeric array from a list or enumerable of numbers and optional nils.
Gets the value at index idx or returns default if out of bounds.
Finds the maximum value in the array.
Calculates the arithmetic mean (average) of the elements as a float.
Finds the minimum value in the array.
Returns a {min, max} tuple in a single pass over the array.
@spec new(numeric_type()) :: t()
Creates a new empty Errow.Numeric array of the given type (defaults to :s64).
Checks if the value at the given index is null (nil).
@spec null_count(t()) :: non_neg_integer()
Returns the count of null values.
Calculates the product of elements in the array. Options:
:skip_nulls- boolean, defaults totrue.
Replaces the element at the given index with a new number or nil.
@spec size(t()) :: non_neg_integer()
Returns the number of elements in the array.
Calculates the sum of elements in the array. Options:
:skip_nulls- boolean, defaults totrue.
Converts the Errow.Numeric array into a standard Elixir list.