Trait Optimize

Source
pub trait Optimize<From> {
    type To;

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

    // Provided method
    fn catch_unwind_optimize(
        &mut self,
        plan: From,
    ) -> Result<Self::To, OptimizerError> { ... }
}
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.

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.

Additionally, if the result of the optimization is an error (not a panic) that indicates we should panic, then panic.

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