diff --git a/optd-persistent/src/bin/init.rs b/optd-persistent/src/bin/init.rs
index c2291d7..e39bd56 100644
--- a/optd-persistent/src/bin/init.rs
+++ b/optd-persistent/src/bin/init.rs
@@ -355,7 +355,8 @@ async fn init_all_tables() -> Result<(), sea_orm::error::DbErr> {
id: Set(1),
physical_expression_id: Set(1),
epoch_id: Set(1),
- cost: Set(10),
+ cost: Set(json!({"compute_cost":10, "io_cost":10})),
+ estimated_statistic: Set(10),
is_valid: Set(true),
};
plan_cost::Entity::insert(plan_cost)
diff --git a/optd-persistent/src/cost_model/interface.rs b/optd-persistent/src/cost_model/interface.rs
index d896ec1..92d7e44 100644
--- a/optd-persistent/src/cost_model/interface.rs
+++ b/optd-persistent/src/cost_model/interface.rs
@@ -67,6 +67,15 @@ pub struct Stat {
pub name: String,
}
+/// TODO: documentation
+#[derive(Clone, Debug, PartialEq)]
+pub struct Cost {
+ pub compute_cost: i32,
+ pub io_cost: i32,
+ // Raw estimated output row count of targeted expression.
+ pub estimated_statistic: i32,
+}
+
/// TODO: documentation
#[trait_variant::make(Send)]
pub trait CostModelStorageLayer {
@@ -91,7 +100,7 @@ pub trait CostModelStorageLayer {
async fn store_cost(
&self,
expr_id: Self::ExprId,
- cost: i32,
+ cost: Cost,
epoch_id: Self::EpochId,
) -> StorageResult<()>;
@@ -126,7 +135,7 @@ pub trait CostModelStorageLayer {
&self,
expr_id: Self::ExprId,
epoch_id: Self::EpochId,
- ) -> StorageResult