Trait mz_compute_types::plan::interpret::Interpreter

source ·
pub trait Interpreter<T = Timestamp> {
    type Domain: Debug + Sized;

    // Required methods
    fn constant(
        &self,
        ctx: &Context<Self::Domain>,
        rows: &Result<Vec<(Row, T, Diff)>, EvalError>,
    ) -> Self::Domain;
    fn get(
        &self,
        ctx: &Context<Self::Domain>,
        id: &Id,
        keys: &AvailableCollections,
        plan: &GetPlan,
    ) -> Self::Domain;
    fn mfp(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        mfp: &MapFilterProject,
        input_key_val: &Option<(Vec<MirScalarExpr>, Option<Row>)>,
    ) -> Self::Domain;
    fn flat_map(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        func: &TableFunc,
        exprs: &Vec<MirScalarExpr>,
        mfp: &MapFilterProject,
        input_key: &Option<Vec<MirScalarExpr>>,
    ) -> Self::Domain;
    fn join(
        &self,
        ctx: &Context<Self::Domain>,
        inputs: Vec<Self::Domain>,
        plan: &JoinPlan,
    ) -> Self::Domain;
    fn reduce(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        key_val_plan: &KeyValPlan,
        plan: &ReducePlan,
        input_key: &Option<Vec<MirScalarExpr>>,
        mfp_after: &MapFilterProject,
    ) -> Self::Domain;
    fn top_k(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        top_k_plan: &TopKPlan,
    ) -> Self::Domain;
    fn negate(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
    ) -> Self::Domain;
    fn threshold(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        threshold_plan: &ThresholdPlan,
    ) -> Self::Domain;
    fn union(
        &self,
        ctx: &Context<Self::Domain>,
        inputs: Vec<Self::Domain>,
        consolidate_output: bool,
    ) -> Self::Domain;
    fn arrange_by(
        &self,
        ctx: &Context<Self::Domain>,
        input: Self::Domain,
        forms: &AvailableCollections,
        input_key: &Option<Vec<MirScalarExpr>>,
        input_mfp: &MapFilterProject,
    ) -> Self::Domain;
}
Expand description

An abstract interpreter for Plan expressions.

This is an object algebra / tagless final encoding of the language defined by crate::plan::Plan, with the exception of the Let* variants. The latter are modeled as part of the various recursion methods, as they are constructs to introduce and reference context.

TODO(database-issues#7446): align this with the Plan structure

Required Associated Types§

source

type Domain: Debug + Sized

TODO(database-issues#7533): Add documentation.

Required Methods§

source

fn constant( &self, ctx: &Context<Self::Domain>, rows: &Result<Vec<(Row, T, Diff)>, EvalError>, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn get( &self, ctx: &Context<Self::Domain>, id: &Id, keys: &AvailableCollections, plan: &GetPlan, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn mfp( &self, ctx: &Context<Self::Domain>, input: Self::Domain, mfp: &MapFilterProject, input_key_val: &Option<(Vec<MirScalarExpr>, Option<Row>)>, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn flat_map( &self, ctx: &Context<Self::Domain>, input: Self::Domain, func: &TableFunc, exprs: &Vec<MirScalarExpr>, mfp: &MapFilterProject, input_key: &Option<Vec<MirScalarExpr>>, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn join( &self, ctx: &Context<Self::Domain>, inputs: Vec<Self::Domain>, plan: &JoinPlan, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn reduce( &self, ctx: &Context<Self::Domain>, input: Self::Domain, key_val_plan: &KeyValPlan, plan: &ReducePlan, input_key: &Option<Vec<MirScalarExpr>>, mfp_after: &MapFilterProject, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn top_k( &self, ctx: &Context<Self::Domain>, input: Self::Domain, top_k_plan: &TopKPlan, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn negate( &self, ctx: &Context<Self::Domain>, input: Self::Domain, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn threshold( &self, ctx: &Context<Self::Domain>, input: Self::Domain, threshold_plan: &ThresholdPlan, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn union( &self, ctx: &Context<Self::Domain>, inputs: Vec<Self::Domain>, consolidate_output: bool, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

source

fn arrange_by( &self, ctx: &Context<Self::Domain>, input: Self::Domain, forms: &AvailableCollections, input_key: &Option<Vec<MirScalarExpr>>, input_mfp: &MapFilterProject, ) -> Self::Domain

TODO(database-issues#7533): Add documentation.

Implementors§