pub enum Expr {
Literal {
value: Value,
span: Span,
},
Column {
field: FieldRef,
span: Span,
},
Parameter {
index: usize,
span: Span,
},
BinaryOp {
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
span: Span,
},
UnaryOp {
op: UnaryOp,
operand: Box<Expr>,
span: Span,
},
Cast {
inner: Box<Expr>,
target: DataType,
span: Span,
},
FunctionCall {
name: String,
args: Vec<Expr>,
span: Span,
},
Case {
branches: Vec<(Expr, Expr)>,
else_: Option<Box<Expr>>,
span: Span,
},
IsNull {
operand: Box<Expr>,
negated: bool,
span: Span,
},
InList {
target: Box<Expr>,
values: Vec<Expr>,
negated: bool,
span: Span,
},
Between {
target: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
negated: bool,
span: Span,
},
Subquery {
query: ExprSubquery,
span: Span,
},
}Expand description
The syntactic expression tree. Every node carries a Span so
semantic errors from the analyze pass can point back at the exact
token range. Created by the Fase 2 parser, consumed by the analyzer
and (eventually) the planner.
Variants§
Literal
A literal value (number, string, boolean, null).
Column
Reference to a column (possibly qualified by table / alias).
Parameter
Query parameter placeholder (? or $n). Used by prepared
statements in Fase 4 — the plan cache strips these so repeated
bindings reuse the same plan.
BinaryOp
Binary infix operator: lhs <op> rhs.
UnaryOp
Prefix unary operator.
Cast
CAST(expr AS type) / expr::type.
FunctionCall
Function / aggregate call.
Case
CASE WHEN cond THEN val [...] [ELSE val] END.
IsNull
IS NULL / IS NOT NULL. Kept as a distinct variant because
SQL treats them as unary postfix operators with special
three-valued semantics.
InList
expr IN (v1, v2, …). The rhs list is Vec<Expr> — at Week 1
only literal lists survive analyze; correlated subquery lists
land in Week 3 alongside the Subquery variant below.
Between
expr BETWEEN low AND high — first-class so pushdown can
recognise range predicates without decomposing to >= and <=.
Subquery
Parenthesized SELECT used in an expression context.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request