optd_core::cost

Trait CostModel

Source
pub trait CostModel<T: RelNodeTyp, M: Memo<T>>:
    'static
    + Send
    + Sync {
    // Required methods
    fn compute_operation_cost(
        &self,
        node: &T,
        data: &Option<Value>,
        children: &[Option<&Statistics>],
        children_cost: &[Cost],
        context: Option<RelNodeContext>,
        optimizer: Option<&CascadesOptimizer<T, M>>,
    ) -> Cost;
    fn derive_statistics(
        &self,
        node: &T,
        data: &Option<Value>,
        children: &[&Statistics],
        context: Option<RelNodeContext>,
        optimizer: Option<&CascadesOptimizer<T, M>>,
    ) -> Statistics;
    fn explain_cost(&self, cost: &Cost) -> String;
    fn explain_statistics(&self, cost: &Statistics) -> String;
    fn accumulate(&self, total_cost: &mut Cost, cost: &Cost);
    fn zero(&self) -> Cost;
    fn weighted_cost(&self, cost: &Cost) -> f64;

    // Provided method
    fn sum(&self, operation_cost: &Cost, inputs_cost: &[Cost]) -> Cost { ... }
}

Required Methods§

Source

fn compute_operation_cost( &self, node: &T, data: &Option<Value>, children: &[Option<&Statistics>], children_cost: &[Cost], context: Option<RelNodeContext>, optimizer: Option<&CascadesOptimizer<T, M>>, ) -> Cost

Compute the cost of a single operation

Source

fn derive_statistics( &self, node: &T, data: &Option<Value>, children: &[&Statistics], context: Option<RelNodeContext>, optimizer: Option<&CascadesOptimizer<T, M>>, ) -> Statistics

Derive the statistics of a single operation

Source

fn explain_cost(&self, cost: &Cost) -> String

Source

fn explain_statistics(&self, cost: &Statistics) -> String

Source

fn accumulate(&self, total_cost: &mut Cost, cost: &Cost)

Source

fn zero(&self) -> Cost

The zero cost.

Source

fn weighted_cost(&self, cost: &Cost) -> f64

The weighted cost of a compound cost.

Provided Methods§

Source

fn sum(&self, operation_cost: &Cost, inputs_cost: &[Cost]) -> Cost

Implementors§