Skip to content

Commit 7fffa30

Browse files
committed
in work
1 parent bcaa89e commit 7fffa30

File tree

6 files changed

+56
-0
lines changed

6 files changed

+56
-0
lines changed

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/aggregate_multiplied_subquery.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ impl NodeInputs for AggregateMultipliedSubqueryInput {
9999
.chain(self.dimension_subqueries.iter()),
100100
)
101101
}
102+
103+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
104+
Box::new(
105+
std::iter::once(&mut self.keys_subquery)
106+
.chain(std::iter::once(&mut self.source))
107+
.chain(self.dimension_subqueries.iter_mut()),
108+
)
109+
}
102110
}
103111

104112
impl PrettyPrint for AggregateMultipliedSubquery {

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/join.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ impl NodeInputs for LogicalJoinInput {
117117
.chain(self.dimension_subqueries.iter()),
118118
)
119119
}
120+
121+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
122+
Box::new(
123+
std::iter::once(&mut self.root)
124+
.chain(self.joins.iter_mut())
125+
.chain(self.dimension_subqueries.iter_mut()),
126+
)
127+
}
120128
}
121129

122130
impl PrettyPrint for LogicalJoin {

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/keys_subquery.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ impl NodeInputs for KeysSubQueryInputs {
6060
fn iter(&self) -> Box<dyn Iterator<Item = &PlanNode> + '_> {
6161
Box::new(std::iter::once(&self.pk_cube).chain(std::iter::once(&self.source)))
6262
}
63+
64+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
65+
Box::new(std::iter::once(&mut self.pk_cube).chain(std::iter::once(&mut self.source)))
66+
}
6367
}
6468

6569
impl PrettyPrint for KeysSubQuery {

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/logical_node.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::rc::Rc;
44

55
pub trait NodeInputs {
66
fn iter(&self) -> Box<dyn Iterator<Item = &PlanNode> + '_>;
7+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_>;
78
}
89

910
pub struct EmptyNodeInput {}
@@ -17,6 +18,10 @@ impl NodeInputs for EmptyNodeInput {
1718
fn iter(&self) -> Box<dyn Iterator<Item = &PlanNode> + '_> {
1819
Box::new(std::iter::empty())
1920
}
21+
22+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
23+
Box::new(std::iter::empty())
24+
}
2025
}
2126

2227
pub struct SingleNodeInput {
@@ -37,6 +42,10 @@ impl NodeInputs for SingleNodeInput {
3742
fn iter(&self) -> Box<dyn Iterator<Item = &PlanNode> + '_> {
3843
Box::new(std::iter::once(&self.item))
3944
}
45+
46+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
47+
Box::new(std::iter::once(&mut self.item))
48+
}
4049
}
4150

4251
pub struct OptionNodeInput {
@@ -61,6 +70,14 @@ impl NodeInputs for OptionNodeInput {
6170
Box::new(std::iter::empty())
6271
}
6372
}
73+
74+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
75+
if let Some(item) = &mut self.item {
76+
Box::new(std::iter::once(item))
77+
} else {
78+
Box::new(std::iter::empty())
79+
}
80+
}
6481
}
6582

6683
pub struct VecNodeInput {
@@ -81,6 +98,10 @@ impl NodeInputs for VecNodeInput {
8198
fn iter(&self) -> Box<dyn Iterator<Item = &PlanNode> + '_> {
8299
Box::new(self.items.iter())
83100
}
101+
102+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
103+
Box::new(self.items.iter_mut())
104+
}
84105
}
85106

86107
pub trait LogicalNode {

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/query.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ impl NodeInputs for QueryInput {
115115
.chain(self.multistage_members.iter())
116116
)
117117
}
118+
119+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
120+
Box::new(
121+
std::iter::once(&mut self.source)
122+
.chain(self.multistage_members.iter_mut())
123+
)
124+
}
118125
}
119126

120127
impl PrettyPrint for Query {

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/resolve_multiplied_measures.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ impl NodeInputs for ResolveMultipliedMeasuresInput {
100100
.chain(self.aggregate_multiplied_subqueries.iter()),
101101
)
102102
}
103+
104+
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut PlanNode> + '_> {
105+
Box::new(
106+
self.regular_measure_subqueries
107+
.iter_mut()
108+
.chain(self.aggregate_multiplied_subqueries.iter_mut()),
109+
)
110+
}
103111
}
104112

105113
impl PrettyPrint for ResolveMultipliedMeasures {

0 commit comments

Comments
 (0)