Skip to content

Commit b5b0a94

Browse files
committed
add get method for id pred and add comments
1 parent 035d97e commit b5b0a94

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

optd-cost-model/src/common/predicates/attr_ref_pred.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use super::id_pred::IdPred;
77
/// An [`AttributeRefPred`] has two children:
88
/// 1. The table id, represented by an [`IdPred`].
99
/// 2. The index of the column, represented by an [`IdPred`].
10+
///
11+
/// Currently, [`AttributeRefPred`] only holds base table attributes, i.e. attributes
12+
/// that already exist in the table. More complex structures may be introduced in the
13+
/// future to represent derived attributes (e.g. t.v1 + t.v2).
1014
#[derive(Clone, Debug)]
1115
pub struct AttributeRefPred(pub ArcPredicateNode);
1216

optd-cost-model/src/common/predicates/id_pred.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ impl IdPred {
2323
.into(),
2424
)
2525
}
26+
27+
/// Gets the id stored in the predicate.
28+
pub fn id(&self) -> usize {
29+
self.0.data.clone().unwrap().as_u64() as usize
30+
}
2631
}
2732

2833
impl ReprPredicateNode for IdPred {

0 commit comments

Comments
 (0)