Skip to main content

ahri_tre_tabular/
error.rs

1use arrow_schema::DataType;
2use thiserror::Error;
3
4pub type Result<T> = std::result::Result<T, TabularError>;
5
6#[derive(Debug, Error)]
7pub enum TabularError {
8    #[error("record batch collection must contain at least one batch")]
9    EmptyBatches,
10    #[error("batch {batch_index} schema does not match table schema")]
11    SchemaMismatch { batch_index: usize },
12    #[error("tabular columns must contain at least one column")]
13    EmptyColumns,
14    #[error("column {name} has {actual} rows but the first column has {expected} rows")]
15    ColumnLengthMismatch {
16        name: String,
17        expected: usize,
18        actual: usize,
19    },
20    #[error("field {field} has unsupported Arrow data type {data_type:?}")]
21    UnsupportedDataType { field: String, data_type: DataType },
22    #[error("field {field} could not be read as Arrow data type {data_type:?}")]
23    ColumnDowncast { field: String, data_type: DataType },
24    #[error("batch size must be greater than zero")]
25    InvalidBatchSize,
26    #[error("I/O operation failed: {0}")]
27    Io(#[from] std::io::Error),
28    #[error("Arrow operation failed: {0}")]
29    Arrow(#[from] arrow_schema::ArrowError),
30    #[error("Parquet operation failed: {0}")]
31    Parquet(#[from] parquet::errors::ParquetError),
32}