/// Check whether the expression is monotonic or not. The left should be <= right.
/// Return the monotonicity information, together with column name if any.
Check whether the expression is monotonic or not. The left should be <= right.
Return the monotonicity information, together with column name if any.
Check whether the expression is monotonic or not . The left should be < = right . Return the monotonicity information together with column name if any .
pub fn check_expression(
        expr: &Expression,
        left: Option<DataColumnWithField>,
        right: Option<DataColumnWithField>,
    ) -> Result<(Monotonicity, String)> {
        let visitor = MonotonicityCheckVisitor {
            mono: None,
            variable_left: left,
            variable_right: right,
            columns: HashSet::new(),
        };
        let visitor = expr.accept(visitor)?;
        // The expression has more than one column, we don't know the monotonicity.
        if visitor.columns.len() != 1 {
            return Ok((Monotonicity::default(), String::new()));
        }
        if visitor.mono.is_none() {
            return Ok((Monotonicity::default(), String::new()));
        }
        let column_name = visitor.columns.iter().next().unwrap().clone();
        let monotonicity = visitor.mono.unwrap();
        Ok((monotonicity, column_name))
    }
pub fn check_expression ( expr : & Expression , left : Option < DataColumnWithField > , right : Option < DataColumnWithField > , ) -> Result < ( Monotonicity , String ) > { let visitor = MonotonicityCheckVisitor { mono : None , variable_left : left , variable_right : right , columns : HashSet :: new ( ) , } ; let visitor = expr . accept ( visitor ) ? ; // The expression has more than one column, we don't know the monotonicity. if visitor . columns . len ( ) != 1 { return Ok ( ( Monotonicity :: default ( ) , String :: new ( ) ) ) ; } if visitor . mono . is_none ( ) { return Ok ( ( Monotonicity :: default ( ) , String :: new ( ) ) ) ; } let column_name = visitor . columns . iter ( ) . next ( ) . unwrap ( ) . clone ( ) ; let monotonicity = visitor . mono . unwrap ( ) ; Ok ( ( monotonicity , column_name ) ) }
Check whether the expression is monotonic or not.
Check whether the expression is monotonic or not .
expr
&Expression
left
Option<DataColumnWithField>
right
Option<DataColumnWithField>