optd_core/optimizer.rs
1// Copyright (c) 2023-2024 CMU Database Group
2//
3// Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at
4// https://opensource.org/licenses/MIT.
5
6use anyhow::Result;
7
8use crate::nodes::{ArcPlanNode, NodeType, PlanNodeOrGroup};
9use crate::property::PropertyBuilder;
10
11pub trait Optimizer<T: NodeType> {
12 fn optimize(&mut self, root_rel: ArcPlanNode<T>) -> Result<ArcPlanNode<T>>;
13 fn get_property<P: PropertyBuilder<T>>(
14 &self,
15 root_rel: PlanNodeOrGroup<T>,
16 idx: usize,
17 ) -> P::Prop;
18}