use partiql_catalog::call_defs::CallLookupError;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct AstTransformationError {
pub errors: Vec<AstTransformError>,
}
#[derive(Error, Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum AstTransformError {
#[error("Not yet implemented: {0}")]
NotYetImplemented(String),
#[error("Illegal State: {0}")]
IllegalState(String),
#[error("Error with literal: {literal}: {error}")]
Literal { literal: String, error: String },
#[error("Invalid number of arguments: {0}")]
InvalidNumberOfArguments(String),
#[error("Unsupported function: {0}")]
UnsupportedFunction(String),
#[error("Unsupported aggregation function: {0}")]
UnsupportedAggregationFunction(String),
#[error("Lowering error: {0}")]
Unknown(String),
#[error("HAVING clause provided without GROUP BY")]
HavingWithoutGroupBy,
}
impl From<CallLookupError> for AstTransformError {
fn from(err: CallLookupError) -> Self {
match err {
CallLookupError::InvalidNumberOfArguments(e) => {
AstTransformError::InvalidNumberOfArguments(e)
}
e => AstTransformError::Unknown(e.to_string()),
}
}
}