Skip to main content

Array

Enum Array 

Source
#[repr(C, align(64))]
pub enum Array { NumericArray(NumericArray), TextArray(TextArray), TemporalArray(TemporalArray), BooleanArray(Arc<BooleanArray<()>>), Null, }
Expand description

§Array

Standard Array type. Wrap in a FieldArray when using inside a Table or as a standalone value requiring tagged metadata.

§Overview

The dual-enum approach may look verbose but works well in practice:

  • Enables clean function signatures with direct access to concrete types (e.g. &NumericArray), supporting trait-aligned dispatch without exhaustive matches at every call site.
  • Supports ergonomic categorisation: functions typically match on the outer enum for broad category handling (numeric, text, temporal, boolean), while allowing inner variant matching for precise type handling.
  • The focused typeset (no nested types) helps keeps enum size efficient as memory is allocated for the largest variant.

§Usage

Functions can accept references tailored to the intended match granularity:

  • &IntegerArray: direct reference to the inner type e.g., arr.num().i64().
  • &NumericArray: any numeric type via arr.num().
  • &Array: match on categories or individual types.

§Benefits

  • No heap allocation or runtime indirection - all enum variants are inline with minimal discriminant cost.
  • Unified call sites with compiler-enforced type safety.
  • Easy casting to inner types (e.g., .str() for strings).
  • Supports aggressive compiler inlining, unlike approaches relying on dynamic dispatch and downcasting.

§Trade-offs

  • Adds ~30–100 ns latency compared to direct inner type calls - only noticeable in extreme low-latency contexts such as HFT.
  • Requires enum matching at dispatch sites compared to direct inner type usage.

§Examples

use minarrow::{
    Array, IntegerArray, NumericArray, arr_bool, arr_f64, arr_i32, arr_i64,
    arr_str32, vec64
};

// Fast macro construction
let int_arr = arr_i32![1, 2, 3, 4];
let float_arr = arr_f64![0.5, 1.5, 2.5];
let bool_arr = arr_bool![true, false, true];
let str_arr = arr_str32!["a", "b", "c"];

assert_eq!(int_arr.len(), 4);
assert_eq!(str_arr.len(), 3);

// Manual construction
let int = IntegerArray::<i64>::from_slice(&[100, 200]);
let wrapped: NumericArray = NumericArray::Int64(std::sync::Arc::new(int));
let array = Array::NumericArray(wrapped);

Variants§

§

NumericArray(NumericArray)

§

TextArray(TextArray)

§

TemporalArray(TemporalArray)

§

BooleanArray(Arc<BooleanArray<()>>)

§

Null

Implementations§

Source§

impl Array

Source

pub fn from_int8(arr: IntegerArray<i8>) -> Array

Creates an Array enum with an Int8 array.

Source

pub fn from_uint8(arr: IntegerArray<u8>) -> Array

Creates an Array enum with an UInt8 array.

Source

pub fn from_int16(arr: IntegerArray<i16>) -> Array

Creates an Array enum with an Int16 array.

Source

pub fn from_uint16(arr: IntegerArray<u16>) -> Array

Creates an Array enum with an UInt16 array.

Source

pub fn from_int32(arr: IntegerArray<i32>) -> Array

Creates an Array enum with an Int32 array.

Examples found in repository?
examples/pycapsule_exchange.rs (line 168)
149fn example_2_export_table_stream(py: Python<'_>) -> PyResult<()> {
150    println!("Example 2: Export MinArrow table -> PyArrow via __arrow_c_stream__");
151    println!("------------------------------------------------------------------");
152
153    let mut ids = IntegerArray::<i32>::default();
154    ids.push(1);
155    ids.push(2);
156    ids.push(3);
157
158    let mut scores = FloatArray::<f64>::default();
159    scores.push(9.5);
160    scores.push(8.3);
161    scores.push(7.1);
162
163    let table = Table::new(
164        "results".to_string(),
165        Some(vec![
166            FieldArray::new(
167                Field::new("id", ArrowType::Int32, false, None),
168                Array::from_int32(ids),
169            ),
170            FieldArray::new(
171                Field::new("score", ArrowType::Float64, false, None),
172                Array::from_float64(scores),
173            ),
174        ]),
175    );
176    println!("  Created MinArrow table: 3 rows x 2 columns (id, score)");
177
178    // Export as a stream capsule and extract the raw pointer for PyArrow
179    let stream_capsule = to_py::table_to_stream_capsule(&table, py)?;
180    let stream_ptr = unsafe {
181        pyo3::ffi::PyCapsule_GetPointer(
182            stream_capsule.as_ptr(),
183            c"arrow_array_stream".as_ptr(),
184        )
185    } as usize;
186
187    let pyarrow = py.import("pyarrow")?;
188    let reader = pyarrow
189        .getattr("RecordBatchReader")?
190        .call_method1("_import_from_c", (stream_ptr,))?;
191    let pa_table = reader.call_method0("read_all")?;
192
193    let num_rows: usize = pa_table.getattr("num_rows")?.extract()?;
194    let schema_repr: String = pa_table.getattr("schema")?.call_method0("__repr__")?.extract()?;
195    println!("  PyArrow received: {} rows", num_rows);
196    println!("  Schema: {}", schema_repr.lines().next().unwrap_or(""));
197    println!("  Done.\n");
198    Ok(())
199}
Source

pub fn from_int64(arr: IntegerArray<i64>) -> Array

Creates an Array enum with an Int64 array.

Examples found in repository?
examples/pycapsule_exchange.rs (line 106)
97fn example_1_export_array(py: Python<'_>) -> PyResult<()> {
98    println!("Example 1: Export MinArrow array -> PyArrow via __arrow_c_array__");
99    println!("----------------------------------------------------------------");
100
101    // Build an array in Rust
102    let mut arr = IntegerArray::<i64>::default();
103    for i in 0..5 {
104        arr.push(i * 10);
105    }
106    let array = Array::from_int64(arr);
107    let field = Field::new("values", ArrowType::Int64, false, None);
108    println!("  Created MinArrow i64 array: [0, 10, 20, 30, 40]");
109
110    // Export as PyCapsules (i.e., schema + array)
111    let (schema_capsule, array_capsule) =
112        to_py::array_to_capsules(Arc::new(array), &field, py)?;
113    println!("  Exported as PyCapsules");
114
115    // Build a wrapper that implements __arrow_c_array__ so PyArrow can consume it.
116    // In a real #[pyfunction] you'd return ArrowArrayWrapper directly;
117    // here we simulate by calling __arrow_c_array__ manually.
118    let pyarrow = py.import("pyarrow")?;
119
120    // PyArrow.Array._import_from_c expects (array_ptr, schema_ptr) as integers,
121    // but we can extract the raw pointers from the capsules properly:
122    let array_ptr = unsafe {
123        pyo3::ffi::PyCapsule_GetPointer(
124            array_capsule.as_ptr(),
125            c"arrow_array".as_ptr(),
126        )
127    } as usize;
128    let schema_ptr = unsafe {
129        pyo3::ffi::PyCapsule_GetPointer(
130            schema_capsule.as_ptr(),
131            c"arrow_schema".as_ptr(),
132        )
133    } as usize;
134
135    let pa_array = pyarrow
136        .getattr("Array")?
137        .call_method1("_import_from_c", (array_ptr, schema_ptr))?;
138
139    let repr: String = pa_array.call_method0("__repr__")?.extract()?;
140    println!("  PyArrow received: {}", repr.lines().next().unwrap_or(""));
141    println!("  Done.\n");
142    Ok(())
143}
Source

pub fn from_uint32(arr: IntegerArray<u32>) -> Array

Creates an Array enum with a UInt32 array.

Source

pub fn from_uint64(arr: IntegerArray<u64>) -> Array

Creates an Array enum with an UInt64 array.

Source

pub fn from_float32(arr: FloatArray<f32>) -> Array

Creates an Array enum with a Float32 array.

Source

pub fn from_float64(arr: FloatArray<f64>) -> Array

Creates an Array enum with a Float64 array.

Examples found in repository?
examples/pycapsule_exchange.rs (line 172)
149fn example_2_export_table_stream(py: Python<'_>) -> PyResult<()> {
150    println!("Example 2: Export MinArrow table -> PyArrow via __arrow_c_stream__");
151    println!("------------------------------------------------------------------");
152
153    let mut ids = IntegerArray::<i32>::default();
154    ids.push(1);
155    ids.push(2);
156    ids.push(3);
157
158    let mut scores = FloatArray::<f64>::default();
159    scores.push(9.5);
160    scores.push(8.3);
161    scores.push(7.1);
162
163    let table = Table::new(
164        "results".to_string(),
165        Some(vec![
166            FieldArray::new(
167                Field::new("id", ArrowType::Int32, false, None),
168                Array::from_int32(ids),
169            ),
170            FieldArray::new(
171                Field::new("score", ArrowType::Float64, false, None),
172                Array::from_float64(scores),
173            ),
174        ]),
175    );
176    println!("  Created MinArrow table: 3 rows x 2 columns (id, score)");
177
178    // Export as a stream capsule and extract the raw pointer for PyArrow
179    let stream_capsule = to_py::table_to_stream_capsule(&table, py)?;
180    let stream_ptr = unsafe {
181        pyo3::ffi::PyCapsule_GetPointer(
182            stream_capsule.as_ptr(),
183            c"arrow_array_stream".as_ptr(),
184        )
185    } as usize;
186
187    let pyarrow = py.import("pyarrow")?;
188    let reader = pyarrow
189        .getattr("RecordBatchReader")?
190        .call_method1("_import_from_c", (stream_ptr,))?;
191    let pa_table = reader.call_method0("read_all")?;
192
193    let num_rows: usize = pa_table.getattr("num_rows")?.extract()?;
194    let schema_repr: String = pa_table.getattr("schema")?.call_method0("__repr__")?.extract()?;
195    println!("  PyArrow received: {} rows", num_rows);
196    println!("  Schema: {}", schema_repr.lines().next().unwrap_or(""));
197    println!("  Done.\n");
198    Ok(())
199}
Source

pub fn from_string32(arr: StringArray<u32>) -> Array

Creates an Array enum with a String32 array.

Source

pub fn from_string64(arr: StringArray<u64>) -> Array

Creates an Array enum with a String64 array.

Source

pub fn from_categorical32(arr: CategoricalArray<u32>) -> Array

Creates an Array enum with a Categorical32 array.

Source

pub fn from_categorical8(arr: CategoricalArray<u8>) -> Array

Creates an Array enum with a Categorical8 array.

Source

pub fn from_categorical16(arr: CategoricalArray<u16>) -> Array

Creates an Array enum with a Categorical16 array.

Source

pub fn from_categorical64(arr: CategoricalArray<u64>) -> Array

Creates an Array enum with a Categorical64 array.

Source

pub fn from_datetime_i32(arr: DatetimeArray<i32>) -> Array

Creates an Array enum with a DatetimeI32 array.

Source

pub fn from_datetime_i64(arr: DatetimeArray<i64>) -> Array

Creates an Array enum with a DatetimeI64 array.

Source

pub fn from_bool(arr: BooleanArray<()>) -> Array

Creates an Array enum with a Boolean array.

Source

pub fn fa(self, name: impl Into<String>) -> FieldArray

Wraps this Array in a FieldArray with the given name.

Infers the Arrow type and nullability from the array itself.

§Example
use minarrow::{Array, IntegerArray, MaskedArray};

let mut arr = IntegerArray::<i32>::default();
arr.push(1);
arr.push(2);
let array = Array::from_int32(arr);
let field_array = array.fa("my_column");
assert_eq!(field_array.field.name, "my_column");
Source

pub fn num_ref(&self) -> Result<&NumericArray, MinarrowError>

Returns a reference to the inner NumericArray if the variant matches. No conversion or cloning is performed.

Source

pub fn str_ref(&self) -> Result<&TextArray, MinarrowError>

Returns a reference to the inner TextArray if the variant matches. No conversion or cloning is performed.

Source

pub fn bool_ref(&self) -> Result<&BooleanArray<()>, MinarrowError>

Returns a reference to the inner BooleanArray if the variant matches. No conversion or cloning is performed.

Source

pub fn dt_ref(&self) -> Result<&TemporalArray, MinarrowError>

Returns a reference to the inner TemporalArray if the variant matches. No conversion or cloning is performed.

Source

pub fn try_i32_ref(&self) -> Result<&IntegerArray<i32>, MinarrowError>

Returns a reference to the inner IntegerArray<i32>.

Source

pub fn try_i64_ref(&self) -> Result<&IntegerArray<i64>, MinarrowError>

Returns a reference to the inner IntegerArray<i64>.

Source

pub fn try_u32_ref(&self) -> Result<&IntegerArray<u32>, MinarrowError>

Returns a reference to the inner IntegerArray<u32>.

Source

pub fn try_u64_ref(&self) -> Result<&IntegerArray<u64>, MinarrowError>

Returns a reference to the inner IntegerArray<u64>.

Source

pub fn try_f32_ref(&self) -> Result<&FloatArray<f32>, MinarrowError>

Returns a reference to the inner FloatArray<f32>.

Source

pub fn try_f64_ref(&self) -> Result<&FloatArray<f64>, MinarrowError>

Returns a reference to the inner FloatArray<f64>.

Source

pub fn try_i8_ref(&self) -> Result<&IntegerArray<i8>, MinarrowError>

Returns a reference to the inner IntegerArray<i8>.

Source

pub fn try_i16_ref(&self) -> Result<&IntegerArray<i16>, MinarrowError>

Returns a reference to the inner IntegerArray<i16>.

Source

pub fn try_u8_ref(&self) -> Result<&IntegerArray<u8>, MinarrowError>

Returns a reference to the inner IntegerArray<u8>.

Source

pub fn try_u16_ref(&self) -> Result<&IntegerArray<u16>, MinarrowError>

Returns a reference to the inner IntegerArray<u16>.

Source

pub fn try_str32_ref(&self) -> Result<&StringArray<u32>, MinarrowError>

Returns a reference to the inner StringArray<u32>.

Source

pub fn try_str64_ref(&self) -> Result<&StringArray<u64>, MinarrowError>

Returns a reference to the inner StringArray<u64>.

Source

pub fn try_cat32_ref(&self) -> Result<&CategoricalArray<u32>, MinarrowError>

Returns a reference to the inner CategoricalArray<u32>.

Source

pub fn try_cat8_ref(&self) -> Result<&CategoricalArray<u8>, MinarrowError>

Returns a reference to the inner CategoricalArray<u8>.

Source

pub fn try_cat16_ref(&self) -> Result<&CategoricalArray<u16>, MinarrowError>

Returns a reference to the inner CategoricalArray<u16>.

Source

pub fn try_cat64_ref(&self) -> Result<&CategoricalArray<u64>, MinarrowError>

Returns a reference to the inner CategoricalArray<u64>.

Source

pub fn try_dt32_ref(&self) -> Result<&DatetimeArray<i32>, MinarrowError>

Returns a reference to the inner DatetimeArray<i32>.

Source

pub fn try_dt64_ref(&self) -> Result<&DatetimeArray<i64>, MinarrowError>

Returns a reference to the inner DatetimeArray<i64>.

Source

pub fn num(self) -> NumericArray

Returns an inner NumericArray, consuming self.

  • If already a NumericArray, consumes and returns the inner value with no clone.
  • Other types: casts and copies.
Source

pub fn str(self) -> TextArray

Returns an inner TextArray, consuming self.

  • If already a TextArray, consumes and returns the inner value with no clone.
  • Other types: casts (to string) and copies.
Source

pub fn bool(self) -> Arc<BooleanArray<()>>

Returns the inner BooleanArray, consuming self.

  • If already a BooleanArray, consumes and returns the inner value with no clone.
  • Other types: calculates the boolean mask based on whether the value is present, and non-zero, and copies. In these cases, any null mask is preserved, rather than becoming false.
Source

pub fn dt(self) -> TemporalArray

Returns the inner TemporalArray, consuming self.

  • If already a TemporalArray, consumes and returns the inner value with no clone.
  • Other types: casts and (often) copies using clone on write.
§Datetime conversions
  • String parses a timestamp in milliseconds since the Unix epoch. If the datetime_ops feature is on, it also attempts common ISO8601/RFC3339 and %Y-%m-%d formats. Keep this in mind, because your API will break if you toggle the datetime_ops feature on/off but keep the previous code.
  • Integer becomes milliseconds since epoch.
  • Floats round as integers to milliseconds since epoch.
  • Boolean returns TemporalArray::Null.
Source

pub fn len(&self) -> usize

Returns the length of the array.

Examples found in repository?
examples/pycapsule_exchange.rs (line 218)
206fn example_3_import_from_pyarrow_array(py: Python<'_>) -> PyResult<()> {
207    println!("Example 3: Import PyArrow array -> MinArrow via __arrow_c_array__");
208    println!("-----------------------------------------------------------------");
209
210    let pyarrow = py.import("pyarrow")?;
211    let py_array = pyarrow.call_method1("array", (vec![100i64, 200, 300, 400, 500],))?;
212    println!("  Created PyArrow array: [100, 200, 300, 400, 500]");
213
214    let result = to_rust::try_capsule_array(&py_array);
215
216    match result {
217        Some(Ok(field_array)) => {
218            println!("  Imported into MinArrow: {} elements", field_array.array.len());
219
220            match &field_array.array {
221                Array::NumericArray(NumericArray::Int64(a)) => {
222                    let values: Vec<i64> = (0..a.len())
223                        .map(|i| a.get(i).unwrap_or(0))
224                        .collect();
225                    println!("  Values: {:?}", values);
226                }
227                other => println!("  Got type: {:?}", std::mem::discriminant(other)),
228            }
229        }
230        Some(Err(e)) => println!("  Import failed: {}", e),
231        None => println!("  __arrow_c_array__ not available on this object"),
232    }
233
234    println!("  Done.\n");
235    Ok(())
236}
237
238/// Import a PyArrow table into MinArrow via __arrow_c_stream__.
239///
240/// The stream protocol is ideal for tabular data - the consumer gets
241/// schema and batches through a single interface.
242fn example_4_import_from_pyarrow_table(py: Python<'_>) -> PyResult<()> {
243    println!("Example 4: Import PyArrow table -> MinArrow via __arrow_c_stream__");
244    println!("------------------------------------------------------------------");
245
246    let pyarrow = py.import("pyarrow")?;
247    let dict = vec![
248        (
249            "name",
250            pyarrow.call_method1("array", (vec!["Alice", "Bob", "Charlie"],))?,
251        ),
252        (
253            "age",
254            pyarrow.call_method1("array", (vec![30i64, 25, 35],))?,
255        ),
256    ]
257    .into_py_dict(py)?;
258
259    let py_table = pyarrow.call_method1("table", (dict,))?;
260    println!("  Created PyArrow table: name=['Alice','Bob','Charlie'], age=[30,25,35]");
261
262    let result = to_rust::try_capsule_record_batch_stream(&py_table);
263
264    match result {
265        Some(Ok((batches, _metadata))) => {
266            println!("  Imported {} batch(es) into MinArrow", batches.len());
267            for (batch_idx, batch) in batches.iter().enumerate() {
268                println!("  Batch {}: {} columns", batch_idx, batch.len());
269                for (col_idx, (array, field)) in batch.iter().enumerate() {
270                    println!(
271                        "    Column {} '{}': {} rows, type={:?}",
272                        col_idx,
273                        field.name,
274                        array.len(),
275                        field.dtype
276                    );
277                }
278            }
279        }
280        Some(Err(e)) => println!("  Import failed: {}", e),
281        None => println!("  __arrow_c_stream__ not available on this object"),
282    }
283
284    println!("  Done.\n");
285    Ok(())
286}
Source

pub fn view(&self, offset: usize, len: usize) -> ArrayV

Returns a metadata view and reference over the specified window of this array.

Does not slice the object (yet).

Panics if out of bounds.

Source

pub fn view_tuple(&self, offset: usize, len: usize) -> (&Array, usize, usize)

Returns a metadata view and reference over the specified window of this array.

Does not slice the object (yet).

Panics if out of bounds.

Source

pub fn inner<T>(&self) -> &Arc<T>
where T: 'static,

Returns a reference to the inner array as type Arc<T>.

This is compile-time safe if T matches the actual payload, but will panic otherwise. Prefer .inner_check() for Option-based pattern.

Source

pub fn inner_mut<T>(&mut self) -> &mut Arc<T>
where T: 'static,

Returns a mutable reference to the inner array as type T.

This method is compile-time safe when the type T matches the actual inner type, but relies on TypeId checks and unsafe casting. If an incorrect type is specified, this will panic at runtime.

Prefer inner_check_mut if you want an Option-based version that avoids panics.

Source

pub fn inner_check<T>(&self) -> Option<&Arc<T>>
where T: 'static,

Returns a reference to the inner array as type T, if the type matches.

This method performs a runtime TypeId check to verify that the provided type T corresponds to the actual inner variant. If the types match, returns Some(&T); otherwise, returns None without panicking.

Use when the type of the variant is uncertain at compile time.

Source

pub fn inner_check_mut<T>(&mut self) -> Option<&mut Arc<T>>
where T: 'static,

Returns a mutable reference to the inner array as type T, if the type matches.

This method performs a runtime TypeId check to verify that the provided type T corresponds to the actual inner variant. If the types match, returns Some(&mut T); otherwise, returns None without panicking.

Use when the type of the variant is uncertain at compile time.

Source

pub fn as_slice<T>(&self, offset: usize, len: usize) -> &[T]

Source

pub fn slice_raw<T>(&self, offset: usize, len: usize) -> Option<&[T]>
where T: 'static,

Source

pub fn slice_clone(&self, offset: usize, len: usize) -> Array

Returns a new Array of the same variant sliced to the given offset and length . Copies the data of the scoped range that’s selected.

If out-of-bounds, returns Self::Null. All null mask, offsets, etc. are trimmed.

Source

pub fn arrow_type(&self) -> ArrowType

Arrow physical type for this array.

Source

pub fn is_nullable(&self) -> bool

Column nullability

Source

pub fn is_categorical_array(&self) -> bool

Returns true if this is a categorical array.

Source

pub fn is_string_array(&self) -> bool

Returns true if this is a string array i.e. non-categorical text.

Source

pub fn is_text_array(&self) -> bool

Returns true if this is any text array, string or categorical.

Source

pub fn is_boolean_array(&self) -> bool

Returns true if this is a boolean array.

Source

pub fn is_integer_array(&self) -> bool

Returns true if this is an integer array.

Source

pub fn is_float_array(&self) -> bool

Returns true if this is a floating-point array.

Source

pub fn is_numerical_array(&self) -> bool

Returns true if this is any numeric array, integer or float.

Source

pub fn is_datetime_array(&self) -> bool

Returns true if this is a datetime/temporal array.

Source

pub fn null_mask(&self) -> Option<&Bitmask>

Returns the underlying null mask of the array

Source

pub fn value_to_string(&self, idx: usize) -> String

Format the element at idx as a human-readable string.

Returns "null" for null elements. Uses the same formatting as the array’s Display implementation.

Source

pub fn null_array(arrow_type: &ArrowType, n_rows: usize) -> Array

Create an all-null array of the given ArrowType with n_rows elements.

The data buffer is zero-filled and every element is masked as null. For datetime types, set the time_unit on the returned array afterwards.

Source

pub fn compare_at(&self, i: usize, j: usize) -> Ordering

Compare two elements within the same array by index.

Uses total ordering for floats via total_cmp(). Nulls sort last: null > any value, null == null.

Source

pub fn set_null_mask(&mut self, mask: Bitmask)

Set null mask on Array by matching on variants

Source

pub fn data_ptr_and_byte_len(&self) -> (*const u8, usize, usize)

Returns a pointer to the backing data (contiguous bytes), length in elements, and element size.

This is not logical length - it is total raw bytes in the buffer, so for non-fixed width types such as bit-packed booleans or strings, please factor this in accordingly.

Source

pub fn null_mask_ptr_and_byte_len(&self) -> Option<(*const u8, usize)>

Returns a pointer to the null mask and its length in bytes, if present.

Source

pub fn offsets_ptr_and_len(&self) -> Option<(*const u8, usize)>

Offsets pointer/len for variable-length types

Source

pub fn null_count(&self) -> usize

Returns the null count of the array

Source

pub fn concat_array(&mut self, other: &Array)

Appends all values (and null mask if present) from other into self.

Panics if the two arrays are of different variants or incompatible types.

This function uses copy-on-write semantics for arrays wrapped in Arc. If self is the only owner of its data, appends are performed in place without copying the first array. If the array data is shared (Arc reference count > 1), the data is first cloned (so the mutation does not affect other owners), and the append is then performed on the unique copy. The second array is allocated into the buffer, which is standard.

Source

pub fn concat_array_range( &mut self, other: &Array, offset: usize, len: usize, ) -> Result<(), MinarrowError>

Appends rows [offset..offset+len) from another array into self. Extends data and null masks directly from the source range.

Source

pub fn insert_rows( &mut self, index: usize, other: &Array, ) -> Result<(), MinarrowError>

Inserts all values (and null mask if present) from other into self at the specified index.

This is an O(n) operation.

Returns an error if the two arrays are of different variants or incompatible types, or if the index is out of bounds.

Source

pub fn split( self, index: usize, field: &Arc<Field>, ) -> Result<SuperArray, MinarrowError>

Splits the Array at the specified index, consuming self and returning a SuperArray with two FieldArray chunks.

Splits the underlying buffers (via vec .split_off()), allocating new storage for the second half. More efficient than cloning the entire array but requires allocation.

Trait Implementations§

Source§

impl AsRef<Array> for PyArray

Source§

fn as_ref(&self) -> &Array

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

impl Clone for Array

Source§

fn clone(&self) -> Array

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Concatenate for Array

Source§

fn concat(self, other: Array) -> Result<Array, MinarrowError>

Concatenates self with other, consuming both and returning a new instance. Read more
Source§

impl Debug for Array

Source§

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

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

impl Default for Array

Source§

fn default() -> Array

Returns the “default value” for a type. Read more
Source§

impl Display for Array

Source§

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

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

impl From<Arc<BooleanArray<()>>> for Array

Source§

fn from(a: Arc<BooleanArray<()>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<CategoricalArray<u16>>> for Array

Available on crate feature extended_categorical only.
Source§

fn from(a: Arc<CategoricalArray<u16>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<CategoricalArray<u32>>> for Array

Available on non-crate feature default_categorical_8 or crate feature extended_categorical only.
Source§

fn from(a: Arc<CategoricalArray<u32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<CategoricalArray<u64>>> for Array

Available on crate feature extended_categorical only.
Source§

fn from(a: Arc<CategoricalArray<u64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<CategoricalArray<u8>>> for Array

Available on crate feature default_categorical_8 only.
Source§

fn from(a: Arc<CategoricalArray<u8>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<DatetimeArray<i32>>> for Array

Available on crate feature datetime only.
Source§

fn from(a: Arc<DatetimeArray<i32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<DatetimeArray<i64>>> for Array

Available on crate feature datetime only.
Source§

fn from(a: Arc<DatetimeArray<i64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<FloatArray<f32>>> for Array

Source§

fn from(a: Arc<FloatArray<f32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<FloatArray<f64>>> for Array

Source§

fn from(a: Arc<FloatArray<f64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<i16>>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: Arc<IntegerArray<i16>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<i32>>> for Array

Source§

fn from(a: Arc<IntegerArray<i32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<i64>>> for Array

Source§

fn from(a: Arc<IntegerArray<i64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<i8>>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: Arc<IntegerArray<i8>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<u16>>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: Arc<IntegerArray<u16>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<u32>>> for Array

Source§

fn from(a: Arc<IntegerArray<u32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<u64>>> for Array

Source§

fn from(a: Arc<IntegerArray<u64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<IntegerArray<u8>>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: Arc<IntegerArray<u8>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<StringArray<u32>>> for Array

Source§

fn from(a: Arc<StringArray<u32>>) -> Array

Converts to this type from the input type.
Source§

impl From<Arc<StringArray<u64>>> for Array

Available on crate feature large_string only.
Source§

fn from(a: Arc<StringArray<u64>>) -> Array

Converts to this type from the input type.
Source§

impl From<Array> for PyArray

Source§

fn from(array: Array) -> Self

Converts to this type from the input type.
Source§

impl From<Array> for SuperArray

Source§

fn from(array: Array) -> SuperArray

Converts to this type from the input type.
Source§

impl From<BooleanArray<()>> for Array

Source§

fn from(a: BooleanArray<()>) -> Array

Converts to this type from the input type.
Source§

impl From<CategoricalArray<u16>> for Array

Available on crate feature extended_categorical only.
Source§

fn from(a: CategoricalArray<u16>) -> Array

Converts to this type from the input type.
Source§

impl From<CategoricalArray<u32>> for Array

Available on non-crate feature default_categorical_8 or crate feature extended_categorical only.
Source§

fn from(a: CategoricalArray<u32>) -> Array

Converts to this type from the input type.
Source§

impl From<CategoricalArray<u64>> for Array

Available on crate feature extended_categorical only.
Source§

fn from(a: CategoricalArray<u64>) -> Array

Converts to this type from the input type.
Source§

impl From<CategoricalArray<u8>> for Array

Available on crate feature default_categorical_8 only.
Source§

fn from(a: CategoricalArray<u8>) -> Array

Converts to this type from the input type.
Source§

impl From<DatetimeArray<i32>> for Array

Available on crate feature datetime only.
Source§

fn from(a: DatetimeArray<i32>) -> Array

Converts to this type from the input type.
Source§

impl From<DatetimeArray<i64>> for Array

Available on crate feature datetime only.
Source§

fn from(a: DatetimeArray<i64>) -> Array

Converts to this type from the input type.
Source§

impl From<FloatArray<f32>> for Array

Source§

fn from(a: FloatArray<f32>) -> Array

Converts to this type from the input type.
Source§

impl From<FloatArray<f64>> for Array

Source§

fn from(a: FloatArray<f64>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<i16>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: IntegerArray<i16>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<i32>> for Array

Source§

fn from(a: IntegerArray<i32>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<i64>> for Array

Source§

fn from(a: IntegerArray<i64>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<i8>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: IntegerArray<i8>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<u16>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: IntegerArray<u16>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<u32>> for Array

Source§

fn from(a: IntegerArray<u32>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<u64>> for Array

Source§

fn from(a: IntegerArray<u64>) -> Array

Converts to this type from the input type.
Source§

impl From<IntegerArray<u8>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(a: IntegerArray<u8>) -> Array

Converts to this type from the input type.
Source§

impl From<StringArray<u32>> for Array

Source§

fn from(a: StringArray<u32>) -> Array

Converts to this type from the input type.
Source§

impl From<StringArray<u64>> for Array

Available on crate feature large_string only.
Source§

fn from(a: StringArray<u64>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<f32>> for Array

Source§

fn from(vec: Vec64<f32>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<f64>> for Array

Source§

fn from(vec: Vec64<f64>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<i16>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(vec: Vec64<i16>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<i32>> for Array

Source§

fn from(vec: Vec64<i32>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<i64>> for Array

Source§

fn from(vec: Vec64<i64>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<i8>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(vec: Vec64<i8>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<u16>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(vec: Vec64<u16>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<u32>> for Array

Source§

fn from(vec: Vec64<u32>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<u64>> for Array

Source§

fn from(vec: Vec64<u64>) -> Array

Converts to this type from the input type.
Source§

impl From<Vec64<u8>> for Array

Available on crate feature extended_numeric_types only.
Source§

fn from(vec: Vec64<u8>) -> Array

Converts to this type from the input type.
Source§

impl FromIterator<Array> for SuperArray

Source§

fn from_iter<T>(iter: T) -> SuperArray
where T: IntoIterator<Item = Array>,

Creates a value from an iterator. Read more
Source§

impl PartialEq for Array

Source§

fn eq(&self, other: &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 RowSelection for Array

Available on crate features select and views only.
Source§

fn r<S>(&self, selection: S) -> ArrayV
where S: DataSelector,

Select rows by index or range, returning an ArrayV (view)

For contiguous selections (ranges), creates a zero-copy view. For non-contiguous selections (index arrays), gathers into a new array.

Source§

type View = ArrayV

The view type returned by selection operations
Source§

fn get_row_count(&self) -> usize

Get the count for data resolution
Source§

impl Shape for Array

Source§

fn shape(&self) -> ShapeDim

Returns arbitrary Shape dimension for any data shape
Source§

fn shape_1d(&self) -> usize

Returns the first dimension shape Read more
Source§

fn shape_2d(&self) -> (usize, usize)

Returns the first and second dimension shapes Read more
Source§

fn shape_3d(&self) -> (usize, usize, usize)

Returns the first, second and third dimension shapes Read more
Source§

fn shape_4d(&self) -> (usize, usize, usize, usize)

Returns the first, second, third and fourth dimension shapes Read more
Source§

impl StructuralPartialEq for Array

Auto Trait Implementations§

§

impl Freeze for Array

§

impl RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl UnsafeUnpin for Array

§

impl UnwindSafe for Array

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CustomValue for T
where T: Any + Send + Sync + Clone + PartialEq + Debug,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Downcasts the type as Any
Source§

fn deep_clone(&self) -> Arc<dyn CustomValue>

Returns a deep clone of the object. Read more
Source§

fn eq_box(&self, other: &(dyn CustomValue + 'static)) -> bool

Performs semantic equality on the boxed object. 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> Print for T
where T: Display,

Source§

fn print(&self)
where Self: Display,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<T> Ungil for T
where T: Send,