use arrow_schema::{ArrowError, DataType, SchemaRef};
use typed_arrow_dyn::DynViewError;
use crate::wal::WalError;
#[derive(Debug, thiserror::Error)]
pub enum KeyExtractError {
#[error("column index {0} out of bounds (num_columns={1})")]
ColumnOutOfBounds(usize, usize),
#[error("unexpected data type for column {col}: expected {expected:?}, got {actual:?}")]
WrongType {
col: usize,
expected: DataType,
actual: DataType,
},
#[error("invalid row index {0} (num_rows={1})")]
RowOutOfBounds(usize, usize),
#[error("unsupported data type for column {col}: {data_type:?}")]
UnsupportedType {
col: usize,
data_type: DataType,
},
#[error("no such field in schema: {name}")]
NoSuchField {
name: String,
},
#[error("schema mismatch: expected {expected:?}, got {actual:?}")]
SchemaMismatch {
expected: SchemaRef,
actual: SchemaRef,
},
#[error("tombstone bitmap length mismatch: expected {expected}, got {actual}")]
TombstoneLengthMismatch {
expected: usize,
actual: usize,
},
#[error("wal error: {0}")]
Wal(#[from] WalError),
#[error("arrow error: {0}")]
Arrow(#[from] ArrowError),
#[error("dyn view error: {0}")]
DynView(#[from] DynViewError),
#[error("memtable full: capacity {capacity} exhausted")]
MemtableFull {
capacity: usize,
},
}