Skip to content

Commit b7034ae

Browse files
committed
add storage part
1 parent c4ab846 commit b7034ae

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

optd-cost-model/src/common/nodes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ impl std::fmt::Display for PhysicalNodeType {
4646
pub enum PredicateType {
4747
List,
4848
Constant(ConstantType),
49-
ColumnRef,
50-
ExternColumnRef,
49+
AttributeRef,
50+
ExternAttributeRef,
5151
UnOp(UnOpType),
5252
BinOp(BinOpType),
5353
LogOp(LogOpType),

optd-cost-model/src/cost_model.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ use crate::{
1212
nodes::{ArcPredicateNode, PhysicalNodeType},
1313
types::ExprId,
1414
},
15+
storage::CostModelStorageManager,
1516
ComputeCostContext, CostModel, CostModelResult, EstimatedStatistic,
1617
};
1718

1819
pub struct CostModelImpl<CMSL: CostModelStorageLayer> {
19-
backend_manager: Arc<CMSL>,
20+
storage_manager: CostModelStorageManager<CMSL>,
2021
default_catalog_source: CatalogSource,
2122
}
2223

2324
impl<CMSL: CostModelStorageLayer> CostModelImpl<CMSL> {
24-
pub fn new(backend_manager: Arc<CMSL>, default_catalog_source: CatalogSource) -> Self {
25+
pub fn new(
26+
storage_manager: CostModelStorageManager<CMSL>,
27+
default_catalog_source: CatalogSource,
28+
) -> Self {
2529
Self {
26-
backend_manager,
30+
storage_manager,
2731
default_catalog_source,
2832
}
2933
}

optd-cost-model/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use optd_persistent::cost_model::interface::{Stat, StatType};
77
pub mod common;
88
pub mod cost;
99
pub mod cost_model;
10+
pub mod storage;
1011

1112
pub enum StatValue {
1213
Int(i64),

optd-cost-model/src/storage.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use std::sync::Arc;
2+
3+
use optd_persistent::CostModelStorageLayer;
4+
5+
pub struct CostModelStorageManager<CMSL: CostModelStorageLayer> {
6+
pub backend_manager: Arc<CMSL>,
7+
// TODO: in-memory cache
8+
}
9+
10+
impl<CMSL: CostModelStorageLayer> CostModelStorageManager<CMSL> {
11+
pub fn new(backend_manager: Arc<CMSL>) -> Self {
12+
Self { backend_manager }
13+
}
14+
}

0 commit comments

Comments
 (0)