fn validate(self) -> DataFusionResult<FieldRefState> {
        use FieldRefState::*;

        let Self {
            operator,
            is_field_ref,
            child_states,
        } = self;

        match (operator, is_field_ref) {
            (Operator::Eq, true) => Ok(Eq),
            (Operator::NotEq, true) => Ok(NotEq),
            (Operator::And, _) => {
                child_states
                    .into_iter()
                    .try_fold(NoPred, |state, child_state| match (state, child_state) {
                        // AND didn't connect children of Pred and NoPreds so it is ok
                        (NoPred, other) | (other, NoPred) => Ok(other),
                        (NotEq, NotEq) => Ok(NotEq),
                        (NotEq, NotEqAnd) | (NotEqAnd, NotEq) | (NotEqAnd, NotEqAnd) => {
                            Ok(NotEqAnd)
                        }
                        _ => Err(unsupported_op_error()),
                    })
            }
            (Operator::Or, _) => {
                child_states
                    .into_iter()
                    .try_fold(NoPred, |state, child_state| match (state, child_state) {
                        // OR didn't connect children of Pred and NoPreds so it is ok
                        (NoPred, other) | (other, NoPred) => Ok(other),
                        (Eq, Eq) => Ok(Eq),
                        (Eq, EqOr) | (EqOr, Eq) | (EqOr, EqOr) => Ok(EqOr),
                        _ => Err(unsupported_op_error()),
                    })
            }
            // Any other operator ensure all children are NoPred
            _ => {
                child_states.into_iter().try_for_each(|child_state| {
                    if !matches!(child_state, NoPred) {
                        Err(unsupported_op_error())
                    } else {
                        Ok(())
                    }
                })?;
                Ok(NoPred)
            }
        }
    }
/// Validates the state of the operator children Returns the state of this operator
Validates the state of the operator children Returns the state of this operator
Validates the state of the operator children Returns the state of this operator
fn validate(self) -> DataFusionResult<FieldRefState> {
        use FieldRefState::*;
        let Self {
            operator,
            is_field_ref,
            child_states,
        } = self;
        match (operator, is_field_ref) {
            (Operator::Eq, true) => Ok(Eq),
            (Operator::NotEq, true) => Ok(NotEq),
            (Operator::And, _) => {
                child_states
                    .into_iter()
                    .try_fold(NoPred, |state, child_state| match (state, child_state) {
                        // AND didn't connect children of Pred and NoPreds so it is ok
                        (NoPred, other) | (other, NoPred) => Ok(other),
                        (NotEq, NotEq) => Ok(NotEq),
                        (NotEq, NotEqAnd) | (NotEqAnd, NotEq) | (NotEqAnd, NotEqAnd) => {
                            Ok(NotEqAnd)
                        }
                        _ => Err(unsupported_op_error()),
                    })
            }
            (Operator::Or, _) => {
                child_states
                    .into_iter()
                    .try_fold(NoPred, |state, child_state| match (state, child_state) {
                        // OR didn't connect children of Pred and NoPreds so it is ok
                        (NoPred, other) | (other, NoPred) => Ok(other),
                        (Eq, Eq) => Ok(Eq),
                        (Eq, EqOr) | (EqOr, Eq) | (EqOr, EqOr) => Ok(EqOr),
                        _ => Err(unsupported_op_error()),
                    })
            }
            // Any other operator ensure all children are NoPred
            _ => {
                child_states.into_iter().try_for_each(|child_state| {
                    if !matches!(child_state, NoPred) {
                        Err(unsupported_op_error())
                    } else {
                        Ok(())
                    }
                })?;
                Ok(NoPred)
            }
        }
    }
fn validate ( self ) -> DataFusionResult < FieldRefState > { use FieldRefState :: * ; let Self { operator , is_field_ref , child_states , } = self ; match ( operator , is_field_ref ) { ( Operator :: Eq , true ) => Ok ( Eq ) , ( Operator :: NotEq , true ) => Ok ( NotEq ) , ( Operator :: And , _ ) => { child_states . into_iter ( ) . try_fold ( NoPred , | state , child_state | match ( state , child_state ) { // AND didn't connect children of Pred and NoPreds so it is ok ( NoPred , other ) | ( other , NoPred ) => Ok ( other ) , ( NotEq , NotEq ) => Ok ( NotEq ) , ( NotEq , NotEqAnd ) | ( NotEqAnd , NotEq ) | ( NotEqAnd , NotEqAnd ) => { Ok ( NotEqAnd ) } _ => Err ( unsupported_op_error ( ) ) , } ) } ( Operator :: Or , _ ) => { child_states . into_iter ( ) . try_fold ( NoPred , | state , child_state | match ( state , child_state ) { // OR didn't connect children of Pred and NoPreds so it is ok ( NoPred , other ) | ( other , NoPred ) => Ok ( other ) , ( Eq , Eq ) => Ok ( Eq ) , ( Eq , EqOr ) | ( EqOr , Eq ) | ( EqOr , EqOr ) => Ok ( EqOr ) , _ => Err ( unsupported_op_error ( ) ) , } ) } // Any other operator ensure all children are NoPred _ => { child_states . into_iter ( ) . try_for_each ( | child_state | { if ! matches ! ( child_state NoPred ) { Err ( unsupported_op_error ( ) ) } else { Ok ( ( ) ) } } ) ? ; Ok ( NoPred ) } } }
Validates the state of the operator children Returns the state of this operator
Validates the state of the operator children Returns the state of this operator
self
self