pub fn action_recursive(
        &self,
        relation: &mut MirRelationExpr,
        arranged: &mut HashMap<Id, Vec<Vec<MirScalarExpr>>>,
    ) -> Result<(), crate::TransformError> {
        if let MirRelationExpr::Let { id, value, body } = relation {
            self.action_recursive(value, arranged)?;
            match &**value {
                MirRelationExpr::ArrangeBy { keys, .. } => {
                    arranged.insert(Id::Local(*id), keys.clone());
                }
                MirRelationExpr::Reduce { group_key, .. } => {
                    arranged.insert(
                        Id::Local(*id),
                        vec![(0..group_key.len()).map(MirScalarExpr::Column).collect()],
                    );
                }
                _ => {}
            }
            self.action_recursive(body, arranged)?;
            arranged.remove(&Id::Local(*id));
            Ok(())
        } else {
            relation.try_visit_mut_children(|e| self.action_recursive(e, arranged))?;
            self.action(relation, arranged);
            Ok(())
        }
    }
/// Pre-order visitor for each `MirRelationExpr` to find join operators.
///
/// This method accumulates state about let-bound arrangements, so that
/// join operators can more accurately assess their available arrangements.
Pre-order visitor for each `MirRelationExpr` to find join operators.
This method accumulates state about let-bound arrangements, so that
join operators can more accurately assess their available arrangements.
Pre - order visitor for each ` MirRelationExpr ` to find join operators . This method accumulates state about let - bound arrangements so that join operators can more accurately assess their available arrangements .
pub fn action_recursive(
        &self,
        relation: &mut MirRelationExpr,
        arranged: &mut HashMap<Id, Vec<Vec<MirScalarExpr>>>,
    ) -> Result<(), crate::TransformError> {
        if let MirRelationExpr::Let { id, value, body } = relation {
            self.action_recursive(value, arranged)?;
            match &**value {
                MirRelationExpr::ArrangeBy { keys, .. } => {
                    arranged.insert(Id::Local(*id), keys.clone());
                }
                MirRelationExpr::Reduce { group_key, .. } => {
                    arranged.insert(
                        Id::Local(*id),
                        vec![(0..group_key.len()).map(MirScalarExpr::Column).collect()],
                    );
                }
                _ => {}
            }
            self.action_recursive(body, arranged)?;
            arranged.remove(&Id::Local(*id));
            Ok(())
        } else {
            relation.try_visit_mut_children(|e| self.action_recursive(e, arranged))?;
            self.action(relation, arranged);
            Ok(())
        }
    }
pub fn action_recursive ( & self , relation : & mut MirRelationExpr , arranged : & mut HashMap < Id , Vec < Vec < MirScalarExpr > > > , ) -> Result < ( ) , crate :: TransformError > { if let MirRelationExpr :: Let { id , value , body } = relation { self . action_recursive ( value , arranged ) ? ; match & * * value { MirRelationExpr :: ArrangeBy { keys , .. } => { arranged . insert ( Id :: Local ( * id ) , keys . clone ( ) ) ; } MirRelationExpr :: Reduce { group_key , .. } => { arranged . insert ( Id :: Local ( * id ) , vec ! [ ( 0 group_key len ( ) ) map ( MirScalarExpr Column ) collect ( ) ] , ) ; } _ => { } } self . action_recursive ( body , arranged ) ? ; arranged . remove ( & Id :: Local ( * id ) ) ; Ok ( ( ) ) } else { relation . try_visit_mut_children ( | e | self . action_recursive ( e , arranged ) ) ? ; self . action ( relation , arranged ) ; Ok ( ( ) ) } }
Pre-order visitor for each `MirRelationExpr` to find join operators.
Pre - order visitor for each ` MirRelationExpr ` to find join operators .
&self
relation
&mut MirRelationExpr
arranged
&mut HashMap<Id, Vec<Vec<MirScalarExpr>>>
&self
relation
&mut MirRelationExpr
arranged
&mut HashMap<Id, Vec<Vec<MirScalarExpr>>>