Skip to main content

optimize_oneshot

Function optimize_oneshot 

Source
fn optimize_oneshot<O, LocalPlan, ResolvedPlan, GlobalPlan>(
    optimizer: &mut O,
    raw_expr: HirRelationExpr,
    resolve: impl FnOnce(LocalPlan) -> ResolvedPlan,
) -> Result<GlobalPlan, OptimizerError>
where O: Optimize<HirRelationExpr, To = LocalPlan> + Optimize<ResolvedPlan, To = GlobalPlan>,
Expand description

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.