use arrow_schema::DataType;
use thiserror::Error;
#[derive(Debug, Error, Clone)]
pub enum CompileError {
#[error("Unsupported expression: {expr_type}")]
UnsupportedExpr {
expr_type: String,
},
#[error("Expected column reference, found {found}")]
NotAColumn {
found: String,
},
#[error("Expected literal value, found {found}")]
NotALiteral {
found: String,
},
#[error("Column '{column_name}' not found in schema")]
ColumnNotFound {
column_name: String,
},
#[error("Cannot cast {literal_type:?} to {target_type:?}: {reason}")]
TypeCastError {
literal_type: DataType,
target_type: DataType,
reason: String,
},
#[error("Negated {predicate_type} predicates are not supported")]
NegatedNotSupported {
predicate_type: String,
},
#[error("Operator '{operator}' is not supported for metadata pruning")]
UnsupportedOperator {
operator: String,
},
#[error("Column '{column_name}' is ambiguous. Candidates: {}", candidates.join(", "))]
AmbiguousColumn {
column_name: String,
candidates: Vec<String>,
},
}