Skip to content

Commit cd52399

Browse files
committed
feat(cubesql): Penalize any join in cost more than wrappers
1 parent 0a47471 commit cd52399

File tree

1 file changed

+9
-0
lines changed
  • rust/cubesql/cubesql/src/compile/rewrite

1 file changed

+9
-0
lines changed

rust/cubesql/cubesql/src/compile/rewrite/cost.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ impl BestCubePlan {
5858
_ => 0,
5959
};
6060

61+
let joins = match enode {
62+
LogicalPlanLanguage::Join(_) => 1,
63+
_ => 0,
64+
};
65+
6166
let wrapper_nodes = match enode {
6267
LogicalPlanLanguage::CubeScanWrapper(_) => 1,
6368
_ => 0,
@@ -203,6 +208,7 @@ impl BestCubePlan {
203208
structure_points,
204209
ungrouped_aggregates: 0,
205210
wrapper_nodes,
211+
joins,
206212
wrapped_select_ungrouped_scan,
207213
empty_wrappers: 0,
208214
ast_size_outside_wrapper: 0,
@@ -241,6 +247,7 @@ pub struct CubePlanCost {
241247
non_pushed_down_window: i64,
242248
non_pushed_down_grouping_sets: i64,
243249
non_pushed_down_limit_sort: i64,
250+
joins: usize,
244251
wrapper_nodes: i64,
245252
wrapped_select_ungrouped_scan: usize,
246253
ast_size_outside_wrapper: usize,
@@ -353,6 +360,7 @@ impl CubePlanCost {
353360
cube_members: self.cube_members + other.cube_members,
354361
errors: self.errors + other.errors,
355362
structure_points: self.structure_points + other.structure_points,
363+
joins: self.joins + other.joins,
356364
empty_wrappers: self.empty_wrappers + other.empty_wrappers,
357365
ast_size_outside_wrapper: self.ast_size_outside_wrapper
358366
+ other.ast_size_outside_wrapper,
@@ -406,6 +414,7 @@ impl CubePlanCost {
406414
cube_members: self.cube_members,
407415
errors: self.errors,
408416
structure_points: self.structure_points,
417+
joins: self.joins,
409418
ast_size_outside_wrapper: match state {
410419
CubePlanState::Wrapped => 0,
411420
CubePlanState::Unwrapped(size) => *size,

0 commit comments

Comments
 (0)