Skip to content

Commit

Permalink
add rcte_cache in OptimizerContext
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed Apr 25, 2024
1 parent 52148e8 commit e18d11a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/frontend/src/optimizer/optimizer_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ use std::sync::Arc;

use risingwave_sqlparser::ast::{ExplainOptions, ExplainType};

use crate::binder::ShareId;
use crate::expr::{CorrelatedId, SessionTimezone};
use crate::handler::HandlerArgs;
use crate::optimizer::plan_node::PlanNodeId;
use crate::session::SessionImpl;
use crate::utils::{OverwriteOptions, WithOptions};
use crate::PlanRef;

const RESERVED_ID_NUM: u16 = 10000;

Expand Down Expand Up @@ -58,6 +60,9 @@ pub struct OptimizerContext {
/// Store the configs can be overwritten in with clause
/// if not specified, use the value from session variable.
overwrite_options: OverwriteOptions,
/// Store the mapping between `share_id` and the corresponding
/// `PlanRef`, used by rcte's planning. (e.g., in `LogicalCteRef`)
rcte_cache: HashMap<ShareId, PlanRef>,

_phantom: PhantomUnsend,
}
Expand Down Expand Up @@ -91,6 +96,7 @@ impl OptimizerContext {
next_expr_display_id: RefCell::new(RESERVED_ID_NUM.into()),
total_rule_applied: RefCell::new(0),
overwrite_options,
rcte_cache: HashMap::new(),
_phantom: Default::default(),
}
}
Expand All @@ -113,6 +119,7 @@ impl OptimizerContext {
next_expr_display_id: RefCell::new(0),
total_rule_applied: RefCell::new(0),
overwrite_options: OverwriteOptions::default(),
rcte_cache: HashMap::new(),
_phantom: Default::default(),
}
.into()
Expand Down

0 comments on commit e18d11a

Please sign in to comment.