Enum databend_common_ast::ast::Expr
source · pub enum Expr {
Show 31 variants
ColumnRef {
span: Span,
column: ColumnRef,
},
IsNull {
span: Span,
expr: Box<Expr>,
not: bool,
},
IsDistinctFrom {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
not: bool,
},
InList {
span: Span,
expr: Box<Expr>,
list: Vec<Expr>,
not: bool,
},
InSubquery {
span: Span,
expr: Box<Expr>,
subquery: Box<Query>,
not: bool,
},
Between {
span: Span,
expr: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
not: bool,
},
BinaryOp {
span: Span,
op: BinaryOperator,
left: Box<Expr>,
right: Box<Expr>,
},
JsonOp {
span: Span,
op: JsonOperator,
left: Box<Expr>,
right: Box<Expr>,
},
UnaryOp {
span: Span,
op: UnaryOperator,
expr: Box<Expr>,
},
Cast {
span: Span,
expr: Box<Expr>,
target_type: TypeName,
pg_style: bool,
},
TryCast {
span: Span,
expr: Box<Expr>,
target_type: TypeName,
},
Extract {
span: Span,
kind: IntervalKind,
expr: Box<Expr>,
},
DatePart {
span: Span,
kind: IntervalKind,
expr: Box<Expr>,
},
Position {
span: Span,
substr_expr: Box<Expr>,
str_expr: Box<Expr>,
},
Substring {
span: Span,
expr: Box<Expr>,
substring_from: Box<Expr>,
substring_for: Option<Box<Expr>>,
},
Trim {
span: Span,
expr: Box<Expr>,
trim_where: Option<(TrimWhere, Box<Expr>)>,
},
Literal {
span: Span,
value: Literal,
},
CountAll {
span: Span,
window: Option<Window>,
},
Tuple {
span: Span,
exprs: Vec<Expr>,
},
FunctionCall {
span: Span,
func: FunctionCall,
},
Case {
span: Span,
operand: Option<Box<Expr>>,
conditions: Vec<Expr>,
results: Vec<Expr>,
else_result: Option<Box<Expr>>,
},
Exists {
span: Span,
not: bool,
subquery: Box<Query>,
},
Subquery {
span: Span,
modifier: Option<SubqueryModifier>,
subquery: Box<Query>,
},
MapAccess {
span: Span,
expr: Box<Expr>,
accessor: MapAccessor,
},
Array {
span: Span,
exprs: Vec<Expr>,
},
Map {
span: Span,
kvs: Vec<(Literal, Expr)>,
},
Interval {
span: Span,
expr: Box<Expr>,
unit: IntervalKind,
},
DateAdd {
span: Span,
unit: IntervalKind,
interval: Box<Expr>,
date: Box<Expr>,
},
DateSub {
span: Span,
unit: IntervalKind,
interval: Box<Expr>,
date: Box<Expr>,
},
DateTrunc {
span: Span,
unit: IntervalKind,
date: Box<Expr>,
},
Hole {
span: Span,
name: String,
},
}Variants§
ColumnRef
Column reference, with indirection like table.column
IsNull
IS [ NOT ] NULL expression
IsDistinctFrom
IS [NOT] DISTINCT expression
InList
[ NOT ] IN (expr, ...)
InSubquery
[ NOT ] IN (SELECT ...)
Between
BETWEEN ... AND ...
BinaryOp
Binary operation
JsonOp
JSON operation
UnaryOp
Unary operation
Cast
CAST expression, like CAST(expr AS target_type)
TryCast
TRY_CAST expression`
Extract
EXTRACT(IntervalKind FROM
DatePart
DATE_PART(IntervalKind,
Position
POSITION(
Substring
SUBSTRING(
Trim
TRIM([[BOTH | LEADING | TRAILING]
Literal
A literal value, such as string, number, date or NULL
CountAll
COUNT(*) expression
Tuple
(foo, bar)
FunctionCall
Scalar/Agg/Window function call
Case
CASE ... WHEN ... ELSE ... expression
Fields
Exists
EXISTS expression
Subquery
Scalar/ANY/ALL/SOME subquery
MapAccess
Access elements of Array, Map and Variant by index or key, like arr[0], or obj:k1
Array
The Array expr
Map
The Map expr
Interval
The Interval 1 DAY expr
DateAdd
DateSub
DateTrunc
Hole
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 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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 more