Skip to content

Commit 6eb725b

Browse files
committed
make get_attribute_info return an option
1 parent e61e7a6 commit 6eb725b

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

optd-cost-model/src/storage.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ use std::sync::Arc;
33

44
use optd_persistent::{
55
cost_model::interface::{Attr, StatType},
6-
BackendManager, CostModelStorageLayer,
6+
CostModelStorageLayer,
77
};
88

9-
use crate::{
10-
common::types::TableId, stats::AttributeCombValueStats, CostModelError, CostModelResult,
11-
SemanticError,
12-
};
9+
use crate::{common::types::TableId, stats::AttributeCombValueStats, CostModelResult};
1310

1411
/// TODO: documentation
1512
pub struct CostModelStorageManager<S: CostModelStorageLayer> {
@@ -29,17 +26,11 @@ impl<S: CostModelStorageLayer> CostModelStorageManager<S> {
2926
&self,
3027
table_id: TableId,
3128
attr_base_index: i32,
32-
) -> CostModelResult<Attr> {
33-
let attr = self
29+
) -> CostModelResult<Option<Attr>> {
30+
Ok(self
3431
.backend_manager
3532
.get_attribute(table_id.into(), attr_base_index)
36-
.await?;
37-
attr.ok_or_else(|| {
38-
CostModelError::SemanticError(SemanticError::AttributeNotFound(
39-
table_id,
40-
attr_base_index,
41-
))
42-
})
33+
.await?)
4334
}
4435

4536
/// TODO: documentation

0 commit comments

Comments
 (0)