fn walk<'a>(expr: &'a MirRelationExpr, explanation: &mut ViewExplanation<'a>) {
            // First, walk the children, in order to perform a post-order
            // traversal.
            match expr {
                // Leaf expressions. Nothing more to visit.
                // TODO [btv] Explain complex sources.
                Constant { .. } | Get { .. } => (),
                // Single-input expressions continue the chain.
                Project { input, .. }
                | Map { input, .. }
                | FlatMap { input, .. }
                | Filter { input, .. }
                | Reduce { input, .. }
                | TopK { input, .. }
                | Negate { input, .. }
                | Threshold { input, .. }
                | DeclareKeys { input, .. }
                | ArrangeBy { input, .. } => walk(input, explanation),
                // For join and union, each input may need to go in its own
                // chain.
                Join { inputs, .. } => walk_many(inputs, explanation),
                Union { base, inputs, .. } => {
                    walk_many(iter::once(&**base).chain(inputs), explanation)
                }
                Let { id, body, value } => {
                    // Similarly the definition of a let goes in its own chain.
                    walk(value, explanation);
                    explanation.chain += 1;

                    // Keep track of the chain ID <-> local ID correspondence.
                    let value_chain = explanation.expr_chain(value);
                    explanation.local_id_chains.insert(*id, value_chain);
                    explanation.chain_local_ids.insert(value_chain, *id);

                    walk(body, explanation);
                }
            }

            // Then record the node.
            explanation.nodes.push(ExplanationNode {
                expr,
                typ: None,
                chain: explanation.chain,
            });
            explanation
                .expr_chains
                .insert(expr as *const MirRelationExpr, explanation.chain);
        }
// Do a post-order traversal of the expression, grouping "chains" of
// nodes together as we go. We have to break the chain whenever we
// encounter a node with multiple inputs, like a join.
Do a post-order traversal of the expression, grouping "chains" of
nodes together as we go. We have to break the chain whenever we
encounter a node with multiple inputs, like a join.
Do a post - order traversal of the expression grouping " chains " of nodes together as we go . We have to break the chain whenever we encounter a node with multiple inputs like a join .
fn walk<'a>(expr: &'a MirRelationExpr, explanation: &mut ViewExplanation<'a>) {
            // First, walk the children, in order to perform a post-order
            // traversal.
            match expr {
                // Leaf expressions. Nothing more to visit.
                // TODO [btv] Explain complex sources.
                Constant { .. } | Get { .. } => (),
                // Single-input expressions continue the chain.
                Project { input, .. }
                | Map { input, .. }
                | FlatMap { input, .. }
                | Filter { input, .. }
                | Reduce { input, .. }
                | TopK { input, .. }
                | Negate { input, .. }
                | Threshold { input, .. }
                | DeclareKeys { input, .. }
                | ArrangeBy { input, .. } => walk(input, explanation),
                // For join and union, each input may need to go in its own
                // chain.
                Join { inputs, .. } => walk_many(inputs, explanation),
                Union { base, inputs, .. } => {
                    walk_many(iter::once(&**base).chain(inputs), explanation)
                }
                Let { id, body, value } => {
                    // Similarly the definition of a let goes in its own chain.
                    walk(value, explanation);
                    explanation.chain += 1;
                    // Keep track of the chain ID <-> local ID correspondence.
                    let value_chain = explanation.expr_chain(value);
                    explanation.local_id_chains.insert(*id, value_chain);
                    explanation.chain_local_ids.insert(value_chain, *id);
                    walk(body, explanation);
                }
            }
            // Then record the node.
            explanation.nodes.push(ExplanationNode {
                expr,
                typ: None,
                chain: explanation.chain,
            });
            explanation
                .expr_chains
                .insert(expr as *const MirRelationExpr, explanation.chain);
        }
fn walk < ' a > ( expr : & ' a MirRelationExpr , explanation : & mut ViewExplanation < ' a > ) { // First, walk the children, in order to perform a post-order // traversal. match expr { // Leaf expressions. Nothing more to visit. // TODO [btv] Explain complex sources. Constant { .. } | Get { .. } => ( ) , // Single-input expressions continue the chain. Project { input , .. } | Map { input , .. } | FlatMap { input , .. } | Filter { input , .. } | Reduce { input , .. } | TopK { input , .. } | Negate { input , .. } | Threshold { input , .. } | DeclareKeys { input , .. } | ArrangeBy { input , .. } => walk ( input , explanation ) , // For join and union, each input may need to go in its own // chain. Join { inputs , .. } => walk_many ( inputs , explanation ) , Union { base , inputs , .. } => { walk_many ( iter :: once ( & * * base ) . chain ( inputs ) , explanation ) } Let { id , body , value } => { // Similarly the definition of a let goes in its own chain. walk ( value , explanation ) ; explanation . chain += 1 ; // Keep track of the chain ID <-> local ID correspondence. let value_chain = explanation . expr_chain ( value ) ; explanation . local_id_chains . insert ( * id , value_chain ) ; explanation . chain_local_ids . insert ( value_chain , * id ) ; walk ( body , explanation ) ; } } // Then record the node. explanation . nodes . push ( ExplanationNode { expr , typ : None , chain : explanation . chain , } ) ; explanation . expr_chains . insert ( expr as * const MirRelationExpr , explanation . chain ) ; }
Do a post-order traversal of the expression, grouping "chains" of
nodes together as we go.
Do a post - order traversal of the expression grouping " chains " of nodes together as we go .
expr
&'a MirRelationExpr
explanation
&mut ViewExplanation<'a>
expr
&'a MirRelationExpr
explanation
&mut ViewExplanation<'a>