Skip to content

Commit 552e54c

Browse files
committed
in work
1 parent 675f484 commit 552e54c

File tree

9 files changed

+40
-48
lines changed

9 files changed

+40
-48
lines changed

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/cube.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,16 @@ impl Cube {
5252
}
5353

5454
impl LogicalNode for Cube {
55-
type InputsType = EmptyNodeInput;
56-
5755
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
5856
PlanNode::Cube(self.clone())
5957
}
6058

61-
fn inputs(&self) -> Self::InputsType {
62-
EmptyNodeInput::new()
59+
fn inputs(&self) -> Vec<PlanNode> {
60+
vec![] // Cube has no inputs
6361
}
6462

65-
fn with_inputs(self: Rc<Self>, inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
63+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
64+
check_inputs_len(&inputs, 0, self.node_name())?;
6665
Ok(self)
6766
}
6867

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/calculation.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,17 @@ impl PrettyPrint for MultiStageMeasureCalculation {
9999
}
100100

101101
impl LogicalNode for MultiStageMeasureCalculation {
102-
type InputsType = SingleNodeInput;
103-
104102
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
105103
PlanNode::MultiStageMeasureCalculation(self.clone())
106104
}
107105

108-
fn inputs(&self) -> Self::InputsType {
109-
SingleNodeInput::new(self.source.as_plan_node())
106+
fn inputs(&self) -> Vec<PlanNode> {
107+
vec![self.source.as_plan_node()]
110108
}
111109

112-
fn with_inputs(self: Rc<Self>, inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
113-
let source = inputs.unpack();
110+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
111+
check_inputs_len(&inputs, 1, self.node_name())?;
112+
let source = &inputs[0];
114113

115114
Ok(Rc::new(Self {
116115
schema: self.schema.clone(),
@@ -119,7 +118,7 @@ impl LogicalNode for MultiStageMeasureCalculation {
119118
partition_by: self.partition_by.clone(),
120119
window_function_to_use: self.window_function_to_use.clone(),
121120
order_by: self.order_by.clone(),
122-
source: source.into_logical_node()?,
121+
source: source.clone().into_logical_node()?,
123122
}))
124123
}
125124

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/get_date_range.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ pub struct MultiStageGetDateRange {
99
}
1010

1111
impl LogicalNode for MultiStageGetDateRange {
12-
type InputsType = SingleNodeInput;
13-
1412
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
1513
PlanNode::MultiStageGetDateRange(self.clone())
1614
}
1715

18-
fn inputs(&self) -> Self::InputsType {
19-
SingleNodeInput::new(self.source.as_plan_node())
16+
fn inputs(&self) -> Vec<PlanNode> {
17+
vec![self.source.as_plan_node()]
2018
}
2119

22-
fn with_inputs(self: Rc<Self>, inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
23-
let source = inputs.unpack();
20+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
21+
check_inputs_len(&inputs, 1, self.node_name())?;
22+
let source = &inputs[0];
2423

2524
Ok(Rc::new(Self {
2625
time_dimension: self.time_dimension.clone(),
27-
source: source.into_logical_node()?,
26+
source: source.clone().into_logical_node()?,
2827
}))
2928
}
3029

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/leaf_measure.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,24 @@ impl PrettyPrint for MultiStageLeafMeasure {
5050
}
5151

5252
impl LogicalNode for MultiStageLeafMeasure {
53-
type InputsType = SingleNodeInput;
54-
5553
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
5654
PlanNode::MultiStageLeafMeasure(self.clone())
5755
}
5856

59-
fn inputs(&self) -> Self::InputsType {
60-
SingleNodeInput::new(self.query.as_plan_node())
57+
fn inputs(&self) -> Vec<PlanNode> {
58+
vec![self.query.as_plan_node()]
6159
}
6260

63-
fn with_inputs(self: Rc<Self>, inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
64-
let query = inputs.unpack();
61+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
62+
check_inputs_len(&inputs, 1, self.node_name())?;
63+
let query = &inputs[0];
6564

6665
Ok(Rc::new(Self {
6766
measure: self.measure.clone(),
6867
render_measure_as_state: self.render_measure_as_state,
6968
render_measure_for_ungrouped: self.render_measure_for_ungrouped,
7069
time_shifts: self.time_shifts.clone(),
71-
query: query.into_logical_node()?,
70+
query: query.clone().into_logical_node()?,
7271
}))
7372
}
7473

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/member.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,17 @@ pub struct LogicalMultiStageMember {
5050
}
5151

5252
impl LogicalNode for LogicalMultiStageMember {
53-
type InputsType = SingleNodeInput;
54-
5553
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
5654
PlanNode::LogicalMultiStageMember(self.clone())
5755
}
5856

59-
fn inputs(&self) -> Self::InputsType {
60-
SingleNodeInput::new(self.member_type.as_plan_node())
57+
fn inputs(&self) -> Vec<PlanNode> {
58+
vec![self.member_type.as_plan_node()]
6159
}
6260

63-
fn with_inputs(self: Rc<Self>, inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
64-
let input = inputs.unpack();
61+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
62+
check_inputs_len(&inputs, 1, self.node_name())?;
63+
let input = inputs[0].clone();
6564

6665
Ok(Rc::new(Self {
6766
name: self.name.clone(),

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/rolling_window.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,16 @@ impl PrettyPrint for MultiStageRollingWindow {
113113
}
114114

115115
impl LogicalNode for MultiStageRollingWindow {
116-
type InputsType = EmptyNodeInput;
117-
118116
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
119117
PlanNode::MultiStageRollingWindow(self.clone())
120118
}
121119

122-
fn inputs(&self) -> Self::InputsType {
123-
EmptyNodeInput::new()
120+
fn inputs(&self) -> Vec<PlanNode> {
121+
vec![] // MultiStageRollingWindow has no inputs
124122
}
125123

126-
fn with_inputs(self: Rc<Self>, _inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
124+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
125+
check_inputs_len(&inputs, 0, self.node_name())?;
127126
Ok(self)
128127
}
129128

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/multistage/time_series.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ impl PrettyPrint for MultiStageTimeSeries {
3535
}
3636

3737
impl LogicalNode for MultiStageTimeSeries {
38-
type InputsType = EmptyNodeInput;
39-
4038
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
4139
PlanNode::MultiStageTimeSeries(self.clone())
4240
}
4341

44-
fn inputs(&self) -> Self::InputsType {
45-
EmptyNodeInput::new()
42+
fn inputs(&self) -> Vec<PlanNode> {
43+
vec![] // MultiStageTimeSeries has no inputs
4644
}
4745

48-
fn with_inputs(self: Rc<Self>, _inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
46+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
47+
check_inputs_len(&inputs, 0, self.node_name())?;
4948
Ok(self)
5049
}
5150

rust/cubesqlplanner/cubesqlplanner/src/logical_plan/pre_aggregation.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ pub struct PreAggregation {
1717
}
1818

1919
impl LogicalNode for PreAggregation {
20-
type InputsType = EmptyNodeInput;
21-
2220
fn as_plan_node(self: &Rc<Self>) -> PlanNode {
2321
PlanNode::PreAggregation(self.clone())
2422
}
2523

26-
fn inputs(&self) -> Self::InputsType {
27-
EmptyNodeInput::new()
24+
fn inputs(&self) -> Vec<PlanNode> {
25+
vec![] // PreAggregation has no inputs
2826
}
2927

30-
fn with_inputs(self: Rc<Self>, _inputs: Self::InputsType) -> Result<Rc<Self>, CubeError> {
28+
fn with_inputs(self: Rc<Self>, inputs: Vec<PlanNode>) -> Result<Rc<Self>, CubeError> {
29+
check_inputs_len(&inputs, 0, self.node_name())?;
3130
Ok(self)
3231
}
3332

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl LogicalNode for Query {
8686
}
8787
}
8888

89-
pub struct QueryInputPacker {}
89+
pub struct QueryInputPacker;
9090

9191
impl QueryInputPacker {
9292
pub fn pack(query: &Query) -> Vec<PlanNode> {

0 commit comments

Comments
 (0)