Skip to content

Commit

Permalink
add children as field
Browse files Browse the repository at this point in the history
  • Loading branch information
connortsui20 committed Nov 15, 2024
1 parent 42321c9 commit 6f41207
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions optd-persistent/src/memo/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub trait Memo {
&self,
group_id: Self::GroupId,
logical_expression: Self::LogicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<()>;

/// Adds a physical expression to an existing group via its [`Self::GroupId`].
Expand All @@ -117,6 +118,7 @@ pub trait Memo {
&self,
group_id: Self::GroupId,
physical_expression: Self::PhysicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<()>;

/// Adds a new logical expression into the memo table, creating a new group if the expression
Expand All @@ -134,5 +136,6 @@ pub trait Memo {
async fn add_logical_expression(
&self,
expression: Self::LogicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<(Self::GroupId, Self::LogicalExpressionId)>;
}
3 changes: 3 additions & 0 deletions optd-persistent/src/memo/orm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl Memo for BackendManager {
&self,
group_id: Self::GroupId,
logical_expression: Self::LogicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<()> {
if logical_expression.group_id != group_id {
Err(MemoError::InvalidExpression)?
Expand All @@ -139,6 +140,7 @@ impl Memo for BackendManager {
&self,
group_id: Self::GroupId,
physical_expression: Self::PhysicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<()> {
if physical_expression.group_id != group_id {
Err(MemoError::InvalidExpression)?
Expand All @@ -160,6 +162,7 @@ impl Memo for BackendManager {
async fn add_logical_expression(
&self,
expression: Self::LogicalExpression,
children: Vec<Self::LogicalExpressionId>,
) -> StorageResult<(Self::GroupId, Self::LogicalExpressionId)> {
// Lookup all expressions that have the same fingerprint. There may be false positives, but
// we will check for those later.
Expand Down

0 comments on commit 6f41207

Please sign in to comment.