graphforge_core/lowering_error.rs
1//! Lowering diagnostics shared with the facade.
2/// Errors that can occur when lowering an IR expression to DataFusion.
3#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
4pub enum LoweringError {
5 /// A function call name has no
6 /// DataFusion built-in equivalent.
7 #[error("unknown built-in function: {0}")]
8 UnknownFunction(String),
9
10 /// An IR expression variant cannot be lowered yet (e.g. `MapLiteral`).
11 #[error("unsupported expression: {0}")]
12 UnsupportedExpr(String),
13
14 /// A variable ID referenced by a `VarRef` or `PropertyAccess` is not in the
15 /// variable map.
16 #[error("unbound variable: VarId({0})")]
17 UnboundVar(u32),
18
19 /// A genuine Cypher type error caught at planning — e.g. a quantifier
20 /// predicate that cannot apply to the list's element type (`x % 2` over a
21 /// string list). A deliberate validation rejection (openCypher
22 /// `InvalidArgumentType`), distinct from a capability gap. (#955)
23 #[error("invalid argument type: {0}")]
24 InvalidType(String),
25}
26
27impl LoweringError {
28 /// Existing public fault domain, with InvalidType corrected for v0.6.0.
29 #[must_use]
30 pub const fn fault_domain(&self) -> &'static str {
31 match self {
32 Self::InvalidType(_) => "validation",
33 _ => "plan",
34 }
35 }
36}