pub trait Optimize<From>: Sendwhere
    From: Send,{
    type To: Send;

    // Required method
    fn optimize(&mut self, plan: From) -> Result<Self::To, OptimizerError>;

    // Provided methods
    fn catch_unwind_optimize(
        &mut self,
        plan: From
    ) -> Result<Self::To, OptimizerError> { ... }
    fn must_optimize(&mut self, expr: From) -> Self::To { ... }
}
Expand description

A trait that represents an optimization stage.

The trait is implemented by structs that encapsulate the context needed to run an end-to-end optimization pipeline for a specific statement type (Index, View, MaterializedView, Subscribe, Select).

Each implementation represents a concrete optimization stage for a fixed statement type that consumes an input of type From and produces output of type Self::To.

The generic lifetime 'ctx models the lifetime of the optimizer context and can be passed to the optimizer struct and the Self::To types.

The 's: 'ctx bound in the optimize method call ensures that an optimizer instance can run an optimization stage that produces a Self::To with &'ctx references.

Required Associated Types§

Required Methods§

source

fn optimize(&mut self, plan: From) -> Result<Self::To, OptimizerError>

Execute the optimization stage, transforming the input plan of type From to an output plan of type To.

Provided Methods§

source

fn catch_unwind_optimize( &mut self, plan: From ) -> Result<Self::To, OptimizerError>

Like Self::optimize, but additionally ensures that panics occurring in the Self::optimize call are caught and demoted to an OptimizerError::Internal error.

source

fn must_optimize(&mut self, expr: From) -> Self::To

Execute the optimization stage and panic if an error occurs.

See Optimize::optimize.

Implementors§

source§

impl Optimize<SubscribeFrom> for mz_adapter::optimize::subscribe::Optimizer

source§

impl Optimize<HirRelationExpr> for mz_adapter::optimize::copy_to::Optimizer

source§

impl Optimize<HirRelationExpr> for mz_adapter::optimize::materialized_view::Optimizer

source§

impl Optimize<HirRelationExpr> for mz_adapter::optimize::peek::Optimizer

source§

impl Optimize<HirRelationExpr> for mz_adapter::optimize::view::Optimizer

source§

impl Optimize<OptimizedMirRelationExpr> for mz_adapter::optimize::materialized_view::Optimizer

This is needed only because the pipeline in the bootstrap code starts from an OptimizedMirRelationExpr attached to a mz_catalog::memory::objects::CatalogItem.

source§

impl Optimize<GlobalMirPlan> for mz_adapter::optimize::index::Optimizer

source§

impl Optimize<Index> for mz_adapter::optimize::index::Optimizer

source§

impl Optimize<GlobalMirPlan> for mz_adapter::optimize::materialized_view::Optimizer

source§

impl Optimize<LocalMirPlan> for mz_adapter::optimize::materialized_view::Optimizer

source§

impl Optimize<GlobalMirPlan<Resolved>> for mz_adapter::optimize::subscribe::Optimizer

source§

impl<'s> Optimize<LocalMirPlan<Resolved<'s>>> for mz_adapter::optimize::copy_to::Optimizer

source§

impl<'s> Optimize<LocalMirPlan<Resolved<'s>>> for mz_adapter::optimize::peek::Optimizer