Skip to main content

arrow_view_state/
error.rs

1//! Error types for the permutation index engine.
2
3use arrow_schema::ArrowError;
4
5/// Errors during index build or application.
6#[derive(Debug, thiserror::Error)]
7pub enum IndexError {
8    /// No columns or no rows were provided.
9    #[error("columns slice must not be empty")]
10    EmptyColumns,
11
12    /// Row count exceeds the `u32::MAX` physical row ID limit.
13    #[error("row count {0} exceeds u32::MAX ({max})", max = u32::MAX)]
14    TooManyRows(u64),
15
16    /// Columns have different lengths, or sort-column count doesn't match fields.
17    #[error("length mismatch: expected {expected}, got {actual}")]
18    LengthMismatch {
19        /// Expected count.
20        expected: u64,
21        /// Actual count.
22        actual: u64,
23    },
24
25    /// Arrow row-encoding failed (usually an unsupported data type).
26    #[error("row encoding failed: {0}")]
27    RowEncodingFailed(#[from] ArrowError),
28
29    /// I/O error during mmap storage creation.
30    #[cfg(feature = "mmap")]
31    #[error("mmap storage error: {0}")]
32    MmapError(std::io::Error),
33
34    /// Predicate evaluation kernel failed (e.g. type mismatch between array and scalar).
35    #[cfg(feature = "evaluate")]
36    #[error("predicate evaluation failed: {0}")]
37    PredicateEvalFailed(String),
38
39    /// Persistence I/O or format error.
40    #[cfg(feature = "persist")]
41    #[error("persistence error: {0}")]
42    PersistError(String),
43
44    /// Column data type is not supported for this index type.
45    #[error("unsupported data type for indexing: {0}")]
46    UnsupportedType(String),
47}