#[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
CapacityOverflow
A requested buffer capacity cannot be expressed as a valid allocation
layout (it overflows isize::MAX once padded to the 64-byte alignment).
AllocationFailed
The global allocator refused an allocation.
BufferTooSmall
A buffer is shorter than the layout it is supposed to back.
UnalignedBuffer
A byte window cannot be reinterpreted as a typed slice because its start address is not aligned for the element type.
Fields
BufferLengthNotMultiple
A byte window cannot be reinterpreted as a typed slice because its length is not a whole number of elements.
InvalidUtf8
String data failed UTF-8 validation.
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
OffsetBufferLength
An offset buffer does not have len + 1 entries.
NonMonotonicOffsets
An offset buffer is not monotonically non-decreasing.
Fields
NegativeOffset
An offset buffer contains a negative entry.
OffsetOutOfBounds
The last offset points past the end of the values buffer.
Fields
ValidityLengthMismatch
A validity bitmap does not cover exactly the array’s logical length.
Fields
BitmapLengthMismatch
Two bitmaps of different lengths were combined.
SliceOutOfBounds
A checked try_slice request left the available range.
The infallible slice methods clamp instead of reporting this.
Fields
IndexOutOfBounds
A checked element access left the array.
InvalidFixedSize
A FixedSizeBinary/FixedSizeList width is not a positive value.
ChildLengthMismatch
A nested array’s child does not have the length its parent implies.
Fields
TypeMismatch
A value’s data type does not match the type its container declares.
Fields
DowncastFailed
A dynamic downcast on an crate::array::ArrayRef failed.
Fields
ColumnCountMismatch
A record batch was built with a column count that disagrees with its schema.
ColumnLengthMismatch
A record batch column has a different length from the batch.
Fields
NullsInNonNullableColumn
A column carries nulls for a field the schema declares non-nullable.
Fields
DuplicateFieldName
A schema declares the same field name twice.
FieldNotFound
A field lookup by name found nothing.
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
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.
TensorRankMismatch
A crate::tensor::TensorView index did not name one component per
dimension.
Fields
TensorAxisOutOfBounds
A crate::tensor::TensorView axis operation named an axis the
tensor does not have.
TensorIndexOutOfBounds
A crate::tensor::TensorView index’s component for one axis is not
smaller than that axis’s extent.
Fields
RequiredFieldIsNull
A row-level accessor (for example
crate::tensor::ImageView::from_struct_row) found a null in a
field the layout declares non-nullable.
OffsetWidthOverflow
crate::kernel::concat() (or a Large* narrowing
crate::kernel::cast()) needed more offset range than the
destination’s offset width can express.
Fields
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).
CastOverflow
crate::kernel::cast() under crate::kernel::OverflowPolicy::Error
found a value that does not fit the destination type.
Fields
MaskLengthMismatch
crate::kernel::filter()’s mask is a different length from the array
it is filtering.
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
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.
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.
Implementations§
Source§impl DataError
impl DataError
Sourcepub fn type_mismatch(expected: DataType, actual: DataType) -> Self
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");Sourcepub fn downcast_failed<A: ?Sized>(actual: DataType) -> Self
pub fn downcast_failed<A: ?Sized>(actual: DataType) -> Self
Builds a DataError::DowncastFailed for the concrete array type A.
Sourcepub fn unsupported_cast(from: DataType, to: DataType) -> Self
pub fn unsupported_cast(from: DataType, to: DataType) -> Self
Builds a DataError::UnsupportedCast without repeating the boxing
at every call site.
Sourcepub fn cast_overflow(from: DataType, to: DataType, index: usize) -> Self
pub fn cast_overflow(from: DataType, to: DataType, index: usize) -> Self
Builds a DataError::CastOverflow without repeating the boxing at
every call site.
Sourcepub const fn is_layout_violation(&self) -> bool
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§
impl Eq for DataError
Source§impl Error for DataError
impl Error for DataError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()