Skip to main content

DataError

Enum DataError 

Source
#[non_exhaustive]
pub enum DataError {
Show 39 variants CapacityOverflow { requested: usize, }, AllocationFailed { bytes: usize, }, BufferTooSmall { required: usize, actual: usize, }, UnalignedBuffer { required: usize, actual: usize, }, BufferLengthNotMultiple { len: usize, width: usize, }, InvalidUtf8 { valid_up_to: usize, }, OffsetNotCharBoundary { index: usize, offset: usize, }, OffsetBufferLength { expected: usize, actual: usize, }, NonMonotonicOffsets { index: usize, offset: i64, }, NegativeOffset { index: usize, offset: i64, }, OffsetOutOfBounds { index: usize, offset: usize, values_len: usize, }, ValidityLengthMismatch { array_len: usize, validity_len: usize, }, BitmapLengthMismatch { left: usize, right: usize, }, SliceOutOfBounds { offset: usize, len: usize, available: usize, }, IndexOutOfBounds { index: usize, len: usize, }, InvalidFixedSize { size: i32, }, ChildLengthMismatch { expected: usize, actual: usize, }, TypeMismatch { expected: Box<DataType>, actual: Box<DataType>, }, DowncastFailed { expected: &'static str, actual: Box<DataType>, }, ColumnCountMismatch { fields: usize, columns: usize, }, ColumnLengthMismatch { index: usize, name: String, expected: usize, actual: usize, }, NullsInNonNullableColumn { index: usize, name: String, null_count: usize, }, DuplicateFieldName { name: String, }, FieldNotFound { name: String, }, UnknownStructLength, TypeUrn(TypeUrnError), TensorShapeMismatch { expected: usize, actual: usize, }, TensorShapeOverflow { shape: Vec<usize>, }, TensorRankMismatch { expected: usize, actual: usize, }, TensorAxisOutOfBounds { axis: usize, ndim: usize, }, TensorIndexOutOfBounds { axis: usize, index: usize, dim: usize, }, RequiredFieldIsNull { field: String, row: usize, }, OffsetWidthOverflow { total: usize, max: usize, }, UnsupportedCast { from: Box<DataType>, to: Box<DataType>, }, CastOverflow { from: Box<DataType>, to: Box<DataType>, index: usize, }, MaskLengthMismatch { array_len: usize, mask_len: usize, }, TakeIndexInvalid { position: usize, len: usize, }, MessageRowCount { actual: usize, }, MessageFixedArrayLength { field: String, expected: usize, actual: usize, },
}
Expand description

Every recoverable failure the columnar core can report.

The enum is #[non_exhaustive]: stages 2 and 3 (Arrow IPC, kernels) extend it at the tail, and downstream crates must keep a wildcard arm.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CapacityOverflow

A requested buffer capacity cannot be expressed as a valid allocation layout (it overflows isize::MAX once padded to the 64-byte alignment).

Fields

§requested: usize

The capacity, in bytes, that was requested.

§

AllocationFailed

The global allocator refused an allocation.

Fields

§bytes: usize

Size of the failed allocation, in bytes.

§

BufferTooSmall

A buffer is shorter than the layout it is supposed to back.

Fields

§required: usize

Bytes the layout needs.

§actual: usize

Bytes the buffer actually holds.

§

UnalignedBuffer

A byte window cannot be reinterpreted as a typed slice because its start address is not aligned for the element type.

Fields

§required: usize

Alignment the element type requires, in bytes.

§actual: usize

Largest power-of-two alignment the buffer address actually has.

§

BufferLengthNotMultiple

A byte window cannot be reinterpreted as a typed slice because its length is not a whole number of elements.

Fields

§len: usize

Length of the byte window.

§width: usize

Width of one element, in bytes.

§

InvalidUtf8

String data failed UTF-8 validation.

Fields

§valid_up_to: usize

Index of the first byte that is not part of a valid sequence.

§

OffsetNotCharBoundary

An offset in a Utf8/LargeUtf8 array splits a multi-byte code point.

The concatenated value region can be valid UTF-8 while an individual slice boundary is not — both checks are required.

Fields

§index: usize

Index of the offending entry in the offset buffer.

§offset: usize

The byte offset that fell inside a code point.

§

OffsetBufferLength

An offset buffer does not have len + 1 entries.

Fields

§expected: usize

Entries required (array length + 1).

§actual: usize

Entries present.

§

NonMonotonicOffsets

An offset buffer is not monotonically non-decreasing.

Fields

§index: usize

Index of the first offset smaller than its predecessor.

§offset: i64

Value of that offset.

§

NegativeOffset

An offset buffer contains a negative entry.

Fields

§index: usize

Index of the negative entry.

§offset: i64

Value of that entry.

§

OffsetOutOfBounds

The last offset points past the end of the values buffer.

Fields

§index: usize

Index of the offending entry.

§offset: usize

Value of that entry.

§values_len: usize

Length of the region the offsets index into.

§

ValidityLengthMismatch

A validity bitmap does not cover exactly the array’s logical length.

Fields

§array_len: usize

Logical length of the array.

§validity_len: usize

Number of bits in the supplied bitmap.

§

BitmapLengthMismatch

Two bitmaps of different lengths were combined.

Fields

§left: usize

Length of the left operand.

§right: usize

Length of the right operand.

§

SliceOutOfBounds

A checked try_slice request left the available range.

The infallible slice methods clamp instead of reporting this.

Fields

§offset: usize

Start of the requested window.

§len: usize

Length of the requested window.

§available: usize

Length actually available.

§

IndexOutOfBounds

A checked element access left the array.

Fields

§index: usize

The index that was requested.

§len: usize

Length of the collection.

§

InvalidFixedSize

A FixedSizeBinary/FixedSizeList width is not a positive value.

Fields

§size: i32

The rejected width.

§

ChildLengthMismatch

A nested array’s child does not have the length its parent implies.

Fields

§expected: usize

Length the parent layout implies.

§actual: usize

Length the child actually has.

§

TypeMismatch

A value’s data type does not match the type its container declares.

Fields

§expected: Box<DataType>

Type the container declares.

§actual: Box<DataType>

Type actually supplied.

§

DowncastFailed

A dynamic downcast on an crate::array::ArrayRef failed.

Fields

§expected: &'static str

Rust type name of the requested concrete array.

§actual: Box<DataType>

Data type of the array actually held.

§

ColumnCountMismatch

A record batch was built with a column count that disagrees with its schema.

Fields

§fields: usize

Number of fields in the schema.

§columns: usize

Number of columns supplied.

§

ColumnLengthMismatch

A record batch column has a different length from the batch.

Fields

§index: usize

Position of the offending column.

§name: String

Name of the field the column belongs to.

§expected: usize

Row count the batch declares.

§actual: usize

Row count the column has.

§

NullsInNonNullableColumn

A column carries nulls for a field the schema declares non-nullable.

Fields

§index: usize

Position of the offending column.

§name: String

Name of the field.

§null_count: usize

Number of nulls found.

§

DuplicateFieldName

A schema declares the same field name twice.

Fields

§name: String

The repeated name.

§

FieldNotFound

A field lookup by name found nothing.

Fields

§name: String

The name that was looked up.

§

UnknownStructLength

A struct array was built without children and without an explicit length, so its logical length is undefined.

§

TypeUrn(TypeUrnError)

A type URN could not be parsed or resolved.

§

TensorShapeMismatch

A crate::tensor::TensorView was built from a flat buffer whose length does not equal the product of the requested shape.

Fields

§expected: usize

Product of the requested shape’s dimensions.

§actual: usize

Length of the buffer actually supplied.

§

TensorShapeOverflow

A crate::tensor::TensorView shape’s dimensions multiply out to more elements than usize can count.

Reported instead of letting the product silently wrap (or panic on a debug build) — no real buffer can back such a shape, so this is always a caller/decode mistake, never a size this crate could ever satisfy.

Fields

§shape: Vec<usize>

The requested shape, verbatim.

§

TensorRankMismatch

A crate::tensor::TensorView index did not name one component per dimension.

Fields

§expected: usize

The tensor’s dimensionality.

§actual: usize

Components the index actually supplied.

§

TensorAxisOutOfBounds

A crate::tensor::TensorView axis operation named an axis the tensor does not have.

Fields

§axis: usize

The axis that was requested.

§ndim: usize

The tensor’s dimensionality.

§

TensorIndexOutOfBounds

A crate::tensor::TensorView index’s component for one axis is not smaller than that axis’s extent.

Fields

§axis: usize

The axis the offending component belongs to.

§index: usize

The component’s value.

§dim: usize

The axis’s extent.

§

RequiredFieldIsNull

A row-level accessor (for example crate::tensor::ImageView::from_struct_row) found a null in a field the layout declares non-nullable.

Fields

§field: String

The field’s name.

§row: usize

The row at which it was found null.

§

OffsetWidthOverflow

crate::kernel::concat() (or a Large* narrowing crate::kernel::cast()) needed more offset range than the destination’s offset width can express.

Fields

§total: usize

Bytes or child elements the result would need.

§max: usize

The offset type’s maximum representable value.

§

UnsupportedCast

crate::kernel::cast() has no defined conversion between two types (for example Bool to anything, or Timestamp to Duration directly — the type system treats those as different units on purpose; go through Int64 explicitly if a conversion is really intended).

Fields

§from: Box<DataType>

The source type.

§to: Box<DataType>

The requested destination type.

§

CastOverflow

crate::kernel::cast() under crate::kernel::OverflowPolicy::Error found a value that does not fit the destination type.

Fields

§from: Box<DataType>

The source type.

§to: Box<DataType>

The destination type.

§index: usize

The offending row.

§

MaskLengthMismatch

crate::kernel::filter()’s mask is a different length from the array it is filtering.

Fields

§array_len: usize

The array’s length.

§mask_len: usize

The mask’s length.

§

TakeIndexInvalid

crate::kernel::take() was given an index that is negative, does not fit usize, or is not smaller than the source’s length.

Fields

§position: usize

The offending index’s position within the indices array.

§len: usize

The source array’s length.

§

MessageRowCount

crate::message::AstrsMessage::from_record_batch requires exactly one row per message (blueprint §6.1’s “one record batch per message” convention), and the batch supplied did not have one.

Fields

§actual: usize

The batch’s actual row count.

§

MessageFixedArrayLength

A [T; N]-shaped message field (crate::message::AstrsMessage) decoded a slice with a different length than N.

Unreachable in practice — crate::array::FixedSizeListArray guarantees every row’s child slice is exactly N elements wide by construction — but TryFrom<&[T]> for [T; N] is still fallible at the type level, so a #[derive(AstrsMessage)] decoder must handle the branch rather than unwrap/expect it away.

Fields

§field: String

The field’s name.

§expected: usize

The array size the layout declares.

§actual: usize

The number of elements actually decoded.

Implementations§

Source§

impl DataError

Source

pub fn type_mismatch(expected: DataType, actual: DataType) -> Self

Builds a DataError::TypeMismatch without repeating the boxing at every call site.

use astrs_data::{DataError, DataType};

let err = DataError::type_mismatch(DataType::Int32, DataType::Int64);
assert_eq!(err.to_string(), "type mismatch: expected Int32, found Int64");
Source

pub fn downcast_failed<A: ?Sized>(actual: DataType) -> Self

Builds a DataError::DowncastFailed for the concrete array type A.

Source

pub fn unsupported_cast(from: DataType, to: DataType) -> Self

Builds a DataError::UnsupportedCast without repeating the boxing at every call site.

Source

pub fn cast_overflow(from: DataType, to: DataType, index: usize) -> Self

Builds a DataError::CastOverflow without repeating the boxing at every call site.

Source

pub const fn is_layout_violation(&self) -> bool

Returns true when the error describes a malformed buffer layout rather than a caller mistake.

Stage 2 uses this to decide whether a decode failure should be reported as a protocol violation (peer sent garbage) or as a local bug.

use astrs_data::DataError;

assert!(DataError::InvalidUtf8 { valid_up_to: 3 }.is_layout_violation());
assert!(!DataError::IndexOutOfBounds { index: 9, len: 2 }.is_layout_violation());

Trait Implementations§

Source§

impl Clone for DataError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DataError

Source§

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

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

impl Display for DataError

Source§

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

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

impl Eq for DataError

Source§

impl Error for DataError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DataError> for IpcError

Source§

fn from(source: DataError) -> Self

Converts to this type from the input type.
Source§

impl From<TypeUrnError> for DataError

Source§

fn from(source: TypeUrnError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DataError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DataError

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> 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> 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.