Enum kip_sql::expression::ScalarExpression
source · pub enum ScalarExpression {
Constant(ValueRef),
ColumnRef(Arc<ColumnCatalog>),
Alias {
expr: Box<ScalarExpression>,
alias: String,
},
TypeCast {
expr: Box<ScalarExpression>,
ty: LogicalType,
},
IsNull {
negated: bool,
expr: Box<ScalarExpression>,
},
Unary {
op: UnaryOperator,
expr: Box<ScalarExpression>,
ty: LogicalType,
},
Binary {
op: BinaryOperator,
left_expr: Box<ScalarExpression>,
right_expr: Box<ScalarExpression>,
ty: LogicalType,
},
AggCall {
distinct: bool,
kind: AggKind,
args: Vec<ScalarExpression>,
ty: LogicalType,
},
In {
negated: bool,
expr: Box<ScalarExpression>,
args: Vec<ScalarExpression>,
},
}
Expand description
ScalarExpression represnet all scalar expression in SQL. SELECT a+1, b FROM t1. a+1 -> ScalarExpression::Unary(a + 1) b -> ScalarExpression::ColumnRef()
Variants§
Constant(ValueRef)
ColumnRef(Arc<ColumnCatalog>)
Alias
TypeCast
IsNull
Unary
Binary
Fields
§
op: BinaryOperator
§
left_expr: Box<ScalarExpression>
§
right_expr: Box<ScalarExpression>
§
ty: LogicalType
AggCall
In
Implementations§
source§impl ScalarExpression
impl ScalarExpression
pub fn exist_column(&self, col_id: &ColumnId) -> bool
pub fn simplify(&mut self) -> Result<(), TypeError>
pub fn constant_calculation(&mut self) -> Result<(), TypeError>
sourcepub fn convert_binary(
&self,
col_id: &ColumnId
) -> Result<Option<ConstantBinary>, TypeError>
pub fn convert_binary( &self, col_id: &ColumnId ) -> Result<Option<ConstantBinary>, TypeError>
The definition of Or is not the Or in the Where condition. The And and Or of ConstantBinary are concerned with the data range that needs to be aggregated.
ConstantBinary::And
: Aggregate the minimum range of all conditions in andConstantBinary::Or
: Rearrange and sort the range of each OR data
source§impl ScalarExpression
impl ScalarExpression
pub fn unpack_alias(&self) -> &ScalarExpression
pub fn has_count_star(&self) -> bool
pub fn nullable(&self) -> bool
pub fn return_type(&self) -> LogicalType
pub fn referenced_columns( &self, only_column_ref: bool ) -> Vec<Arc<ColumnCatalog>>
pub fn has_agg_call(&self) -> bool
pub fn output_column(&self) -> Arc<ColumnCatalog>
Trait Implementations§
source§impl Clone for ScalarExpression
impl Clone for ScalarExpression
source§fn clone(&self) -> ScalarExpression
fn clone(&self) -> ScalarExpression
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScalarExpression
impl Debug for ScalarExpression
source§impl<'de> Deserialize<'de> for ScalarExpression
impl<'de> Deserialize<'de> for ScalarExpression
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for ScalarExpression
impl Hash for ScalarExpression
source§impl PartialEq for ScalarExpression
impl PartialEq for ScalarExpression
source§fn eq(&self, other: &ScalarExpression) -> bool
fn eq(&self, other: &ScalarExpression) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ScalarExpression
impl Serialize for ScalarExpression
impl Eq for ScalarExpression
impl StructuralEq for ScalarExpression
impl StructuralPartialEq for ScalarExpression
Auto Trait Implementations§
impl RefUnwindSafe for ScalarExpression
impl Send for ScalarExpression
impl Sync for ScalarExpression
impl Unpin for ScalarExpression
impl UnwindSafe for ScalarExpression
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.