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

Fields

§span: Span
§column: ColumnRef
§

IsNull

IS [ NOT ] NULL expression

Fields

§span: Span
§expr: Box<Expr>
§not: bool
§

IsDistinctFrom

IS [NOT] DISTINCT expression

Fields

§span: Span
§left: Box<Expr>
§right: Box<Expr>
§not: bool
§

InList

[ NOT ] IN (expr, ...)

Fields

§span: Span
§expr: Box<Expr>
§list: Vec<Expr>
§not: bool
§

InSubquery

[ NOT ] IN (SELECT ...)

Fields

§span: Span
§expr: Box<Expr>
§subquery: Box<Query>
§not: bool
§

Between

BETWEEN ... AND ...

Fields

§span: Span
§expr: Box<Expr>
§low: Box<Expr>
§high: Box<Expr>
§not: bool
§

BinaryOp

Binary operation

Fields

§span: Span
§left: Box<Expr>
§right: Box<Expr>
§

JsonOp

JSON operation

Fields

§span: Span
§left: Box<Expr>
§right: Box<Expr>
§

UnaryOp

Unary operation

Fields

§span: Span
§expr: Box<Expr>
§

Cast

CAST expression, like CAST(expr AS target_type)

Fields

§span: Span
§expr: Box<Expr>
§target_type: TypeName
§pg_style: bool
§

TryCast

TRY_CAST expression`

Fields

§span: Span
§expr: Box<Expr>
§target_type: TypeName
§

Extract

EXTRACT(IntervalKind FROM )

Fields

§span: Span
§expr: Box<Expr>
§

DatePart

DATE_PART(IntervalKind, )

Fields

§span: Span
§expr: Box<Expr>
§

Position

POSITION( IN )

Fields

§span: Span
§substr_expr: Box<Expr>
§str_expr: Box<Expr>
§

Substring

SUBSTRING( [FROM ] [FOR ])

Fields

§span: Span
§expr: Box<Expr>
§substring_from: Box<Expr>
§substring_for: Option<Box<Expr>>
§

Trim

TRIM([[BOTH | LEADING | TRAILING] FROM] ) Or TRIM()

Fields

§span: Span
§expr: Box<Expr>
§trim_where: Option<(TrimWhere, Box<Expr>)>
§

Literal

A literal value, such as string, number, date or NULL

Fields

§span: Span
§value: Literal
§

CountAll

COUNT(*) expression

Fields

§span: Span
§window: Option<Window>
§

Tuple

(foo, bar)

Fields

§span: Span
§exprs: Vec<Expr>
§

FunctionCall

Scalar/Agg/Window function call

Fields

§span: Span
§

Case

CASE ... WHEN ... ELSE ... expression

Fields

§span: Span
§operand: Option<Box<Expr>>
§conditions: Vec<Expr>
§results: Vec<Expr>
§else_result: Option<Box<Expr>>
§

Exists

EXISTS expression

Fields

§span: Span
§not: bool

Indicate if this is a NOT EXISTS

§subquery: Box<Query>
§

Subquery

Scalar/ANY/ALL/SOME subquery

Fields

§span: Span
§subquery: Box<Query>
§

MapAccess

Access elements of Array, Map and Variant by index or key, like arr[0], or obj:k1

Fields

§span: Span
§expr: Box<Expr>
§accessor: MapAccessor
§

Array

The Array expr

Fields

§span: Span
§exprs: Vec<Expr>
§

Map

The Map expr

Fields

§span: Span
§kvs: Vec<(Literal, Expr)>
§

Interval

The Interval 1 DAY expr

Fields

§span: Span
§expr: Box<Expr>
§

DateAdd

Fields

§span: Span
§interval: Box<Expr>
§date: Box<Expr>
§

DateSub

Fields

§span: Span
§interval: Box<Expr>
§date: Box<Expr>
§

DateTrunc

Fields

§span: Span
§date: Box<Expr>
§

Hole

Fields

§span: Span
§name: String

Implementations§

source§

impl Expr

source

pub fn span(&self) -> Span

source

pub fn whole_span(&self) -> Span

source

pub fn all_function_like_syntaxes() -> &'static [&'static str]

source§

impl Expr

source

pub fn affix(&self) -> Affix

Trait Implementations§

source§

impl Clone for Expr

source§

fn clone(&self) -> Expr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Expr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Expr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drive for Expr

source§

fn drive<V: Visitor>(&self, visitor: &mut V)

source§

impl DriveMut for Expr

source§

fn drive_mut<V: VisitorMut>(&mut self, visitor: &mut V)

source§

impl PartialEq for Expr

source§

fn eq(&self, other: &Expr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V