Skip to content

Commit 625e129

Browse files
committed
make MemoExt a member field of the cost model
1 parent e730925 commit 625e129

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

optd-cost-model/src/cost_model.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{
1212
nodes::{ArcPredicateNode, PhysicalNodeType},
1313
types::{AttrId, EpochId, ExprId, TableId},
1414
},
15+
memo_ext::MemoExt,
1516
storage::CostModelStorageManager,
1617
ComputeCostContext, Cost, CostModel, CostModelResult, EstimatedStatistic, StatValue,
1718
};
@@ -20,22 +21,25 @@ use crate::{
2021
pub struct CostModelImpl<S: CostModelStorageLayer> {
2122
storage_manager: CostModelStorageManager<S>,
2223
default_catalog_source: CatalogSource,
24+
_memo: Arc<dyn MemoExt>,
2325
}
2426

2527
impl<S: CostModelStorageLayer> CostModelImpl<S> {
2628
/// TODO: documentation
2729
pub fn new(
2830
storage_manager: CostModelStorageManager<S>,
2931
default_catalog_source: CatalogSource,
32+
memo: Arc<dyn MemoExt>,
3033
) -> Self {
3134
Self {
3235
storage_manager,
3336
default_catalog_source,
37+
_memo: memo,
3438
}
3539
}
3640
}
3741

38-
impl<S: CostModelStorageLayer + std::marker::Sync + 'static> CostModel for CostModelImpl<S> {
42+
impl<S: CostModelStorageLayer + Sync + 'static> CostModel for CostModelImpl<S> {
3943
fn compute_operation_cost(
4044
&self,
4145
node: &PhysicalNodeType,

optd-cost-model/src/memo_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::common::{
33
types::GroupId,
44
};
55

6-
pub trait MemoExt {
6+
pub trait MemoExt: Send + Sync + 'static {
77
fn get_schema(&self, group_id: GroupId) -> Schema;
88
fn get_column_ref(&self, group_id: GroupId) -> GroupAttrRefs;
99
fn get_attribute_info(&self, group_id: GroupId, attr_ref_idx: u64) -> Attribute;

0 commit comments

Comments
 (0)