Skip to main content

oxisql_datafusion/
error.rs

1//! Error type for the `oxisql-datafusion` crate.
2
3/// Errors that can occur while bridging OxiSQL rows to DataFusion.
4#[derive(Debug, thiserror::Error)]
5pub enum OxiSqlFusionError {
6    /// An error originating from the OxiSQL layer.
7    #[error("oxisql error: {0}")]
8    OxiSql(String),
9
10    /// An Arrow error encountered while building a `RecordBatch`.
11    #[error("arrow error: {0}")]
12    Arrow(#[from] arrow::error::ArrowError),
13
14    /// A DataFusion error propagated from the execution layer.
15    #[error("datafusion error: {0}")]
16    DataFusion(#[from] datafusion::error::DataFusionError),
17
18    /// Schema mismatch: row column count does not match the schema.
19    #[error("schema mismatch: expected {expected} columns, got {got}")]
20    SchemaMismatch {
21        /// Number of fields in the Arrow schema.
22        expected: usize,
23        /// Number of values in the OxiSQL row.
24        got: usize,
25    },
26
27    /// An Arrow [`DataType`] that has no corresponding OxiSQL `Value` mapping.
28    ///
29    /// [`DataType`]: arrow::datatypes::DataType
30    #[error("unsupported Arrow type: {0}")]
31    UnsupportedType(String),
32}