Runs the shared one-shot optimization pipeline for a single optimizer. This factors out the (otherwise duplicated) HIR ⇒ local MIR ⇒ resolve ⇒ global LIR sequence that is common to the `SELECT`/`EXPLAIN` and `COPY TO` paths. The `resolve` closure attaches the timestamp/session/stats context to the local plan; it is path-specific only in the concrete plan type it operates on.
(
optimizer: &mut O,
raw_expr: HirRelationExpr,
resolve: impl FnOnce(LocalPlan) -> ResolvedPlan,
)
| 224 | /// the local plan; it is path-specific only in the concrete plan type it |
| 225 | /// operates on. |
| 226 | pub(crate) fn optimize_oneshot<O, LocalPlan, ResolvedPlan, GlobalPlan>( |
| 227 | optimizer: &mut O, |
| 228 | raw_expr: HirRelationExpr, |
| 229 | resolve: impl FnOnce(LocalPlan) -> ResolvedPlan, |
| 230 | ) -> Result<GlobalPlan, OptimizerError> |
| 231 | where |
| 232 | O: Optimize<HirRelationExpr, To = LocalPlan> + Optimize<ResolvedPlan, To = GlobalPlan>, |
| 233 | { |
| 234 | // HIR ⇒ MIR lowering and MIR optimization (local). |
| 235 | let local_mir_plan = optimizer.catch_unwind_optimize(raw_expr)?; |
| 236 | // Attach resolved context required to continue the pipeline. |
| 237 | let resolved_mir_plan = resolve(local_mir_plan); |
| 238 | // MIR optimization (global), MIR ⇒ LIR lowering, and LIR optimization (global). |
| 239 | optimizer.catch_unwind_optimize(resolved_mir_plan) |
| 240 | } |
| 241 | |
| 242 | // Optimizer configuration |
| 243 | // ----------------------- |
no test coverage detected