1use crate::eval::evaluable::Evaluable;
2use crate::eval::expr::EvalExpr;
3use crate::eval::EvalContext;
4use partiql_catalog::extension::ExtensionResultError;
5use partiql_value::datum::RefTupleView;
6use partiql_value::Value;
7use std::borrow::Cow;
8use thiserror::Error;
9
10#[derive(Debug)]
12pub struct PlanErr {
13 pub errors: Vec<PlanningError>,
14}
15
16#[derive(Error, Debug, Clone, PartialEq, Eq, Hash)]
18#[non_exhaustive]
19pub enum PlanningError {
20 #[error("Not yet implemented: {0}")]
22 NotYetImplemented(String),
23 #[error("Illegal State: {0}")]
25 IllegalState(String),
26}
27
28#[derive(Debug)]
30pub struct EvalErr {
31 pub errors: Vec<EvaluationError>,
32}
33
34#[derive(Error, Debug)]
36#[non_exhaustive]
37pub enum EvaluationError {
38 #[error("Illegal State: {0}")]
40 IllegalState(String),
41 #[error("Evaluation Error: invalid evaluation plan detected `{0}`")]
43 InvalidEvaluationPlan(String),
44 #[error("Not yet implemented: {0}")]
46 NotYetImplemented(String),
47
48 #[error("Extension Result Expression Error")]
50 ExtensionResultError(#[from] ExtensionResultError),
51}
52
53#[derive(Debug)]
56pub(crate) struct ErrorNode {}
57
58impl ErrorNode {
59 pub(crate) fn new() -> ErrorNode {
60 ErrorNode {}
61 }
62}
63
64impl Evaluable for ErrorNode {
65 fn evaluate(&self, _: [Option<Value>; 2], _ctx: &dyn EvalContext) -> Value {
66 panic!("ErrorNode will not be evaluated")
67 }
68}
69
70impl EvalExpr for ErrorNode {
71 fn evaluate<'a, 'c, 'o>(
72 &'a self,
73 _bindings: &'a dyn RefTupleView<'a, Value>,
74 _ctx: &'c dyn EvalContext,
75 ) -> Cow<'o, Value>
76 where
77 'c: 'a,
78 'a: 'o,
79 {
80 panic!("ErrorNode will not be evaluated")
81 }
82}