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,
)
| 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( |
no test coverage detected