Skip to content

Commit 45e0ca0

Browse files
committed
fix failed tests
1 parent baaaf7a commit 45e0ca0

File tree

1 file changed

+37
-1
lines changed
  • optd-persistent/src/cost_model

1 file changed

+37
-1
lines changed

optd-persistent/src/cost_model/orm.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl CostModelStorageLayer for BackendManager {
628628
}
629629
}
630630
if update {
631-
assert!(new_cost.epoch_id == sea_orm::ActiveValue::Set(epoch_id_data));
631+
assert!(new_cost.epoch_id.is_unchanged());
632632
let _ = PlanCost::update(new_cost).exec(&transaction).await?;
633633
}
634634
} else {
@@ -1072,6 +1072,18 @@ mod tests {
10721072
.create_new_epoch("source".to_string(), "data".to_string())
10731073
.await
10741074
.unwrap();
1075+
let stat = Stat {
1076+
stat_type: StatType::TableRowCount,
1077+
stat_value: json!(10),
1078+
attr_ids: vec![],
1079+
table_id: Some(1),
1080+
name: "row_count".to_owned(),
1081+
};
1082+
let res = backend_manager
1083+
.update_stats(stat, EpochOption::Existed(epoch_id))
1084+
.await;
1085+
assert!(res.is_ok());
1086+
10751087
let physical_expression_id = 1;
10761088
let cost = Cost {
10771089
compute_cost: 42.0,
@@ -1139,6 +1151,18 @@ mod tests {
11391151
.create_new_epoch("source".to_string(), "data".to_string())
11401152
.await
11411153
.unwrap();
1154+
let stat = Stat {
1155+
stat_type: StatType::TableRowCount,
1156+
stat_value: json!(10),
1157+
attr_ids: vec![],
1158+
table_id: Some(1),
1159+
name: "row_count".to_owned(),
1160+
};
1161+
let res = backend_manager
1162+
.update_stats(stat, EpochOption::Existed(epoch_id))
1163+
.await;
1164+
assert!(res.is_ok());
1165+
11421166
let physical_expression_id = 1;
11431167
let cost = Cost {
11441168
compute_cost: 42.0,
@@ -1185,6 +1209,18 @@ mod tests {
11851209
.create_new_epoch("source".to_string(), "data".to_string())
11861210
.await
11871211
.unwrap();
1212+
let stat = Stat {
1213+
stat_type: StatType::TableRowCount,
1214+
stat_value: json!(10),
1215+
attr_ids: vec![],
1216+
table_id: Some(1),
1217+
name: "row_count".to_owned(),
1218+
};
1219+
let res = backend_manager
1220+
.update_stats(stat, EpochOption::Existed(epoch_id))
1221+
.await;
1222+
assert!(res.is_ok());
1223+
11881224
let physical_expression_id = 1;
11891225
let estimated_statistic = 42.0;
11901226
let _ = backend_manager

0 commit comments

Comments
 (0)