Skip to content

Commit 51da144

Browse files
committed
Add comment for the guideline of re-designing PredicateNode
1 parent 155f2d2 commit 51da144

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ pub struct PredicateNode {
8282
/// TODO: If it is PredicateType::AttributeRef, then
8383
/// the data is attribute index. But we need more information
8484
/// to represent this attribute in case it is a derived attribute.
85+
/// 1. We can use Vec<Value>, but the disadvantage is that the optimizer
86+
/// may need to do some memory copy. (However, if we want to provide a
87+
/// general API, the memory copy is unavoidable. It applies for both 1
88+
/// and 2 designs). And Vec<Value> lacks readability.
89+
/// 2. Also we can use enum, but if Rust uses something like `union` to
90+
/// implement enum, then if some members are large, it will waste memory space,
91+
/// also causing unnecessary memory copy. But enum provides better readability.
8592
pub data: Option<Value>,
8693
}
8794

0 commit comments

Comments
 (0)