MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / action_recursive

Method action_recursive

src/transform/src/join_implementation.rs:90–127  ·  view source on GitHub ↗

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.

(
        &self,
        relation: &mut MirRelationExpr,
        indexes: &mut IndexMap,
        stats: &dyn StatisticsOracle,
        features: &OptimizerFeatures,
    )

Source from the content-addressed store, hash-verified

88 /// This method accumulates state about let-bound arrangements, so that
89 /// join operators can more accurately assess their available arrangements.
90 pub fn action_recursive(
91 &self,
92 relation: &mut MirRelationExpr,
93 indexes: &mut IndexMap,
94 stats: &dyn StatisticsOracle,
95 features: &OptimizerFeatures,
96 ) -> Result<(), TransformError> {
97 self.checked_recur(|_| {
98 if let MirRelationExpr::Let { id, value, body } = relation {
99 self.action_recursive(value, indexes, stats, features)?;
100 match &**value {
101 MirRelationExpr::ArrangeBy { keys, .. } => {
102 for key in keys {
103 indexes.add_local(*id, key.clone());
104 }
105 }
106 MirRelationExpr::Reduce { group_key, .. } => {
107 indexes.add_local(
108 *id,
109 (0..group_key.len()).map(MirScalarExpr::column).collect(),
110 );
111 }
112 _ => {}
113 }
114 self.action_recursive(body, indexes, stats, features)?;
115 indexes.remove_local(*id);
116 Ok(())
117 } else {
118 let (mfp, mfp_input) =
119 MapFilterProject::extract_non_errors_from_expr_ref_mut(relation);
120 mfp_input.try_visit_mut_children(|e| {
121 self.action_recursive(e, indexes, stats, features)
122 })?;
123 self.action(mfp_input, mfp, indexes, stats, features)?;
124 Ok(())
125 }
126 })
127 }
128
129 /// Determines the join implementation for join operators.
130 pub fn action(

Callers 1

Calls 9

checked_recurMethod · 0.80
add_localMethod · 0.80
remove_localMethod · 0.80
cloneMethod · 0.45
collectMethod · 0.45
mapMethod · 0.45
lenMethod · 0.45
actionMethod · 0.45

Tested by

no test coverage detected