Skip to content

Commit 06bef33

Browse files
committed
chore(cubesql): Enable ProjectionDropOut optimizer
1 parent 15faa24 commit 06bef33

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

rust/cubesql/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubesql/cubesql/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ documentation = "https://cube.dev/docs"
99
homepage = "https://cube.dev"
1010

1111
[dependencies]
12-
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "94ddd00d3b7466830d28f0cc0ca2d03c2cde7234", default-features = false, features = ["unicode_expressions"] }
12+
datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "a29e681ada5918c6d09bb7a02aa2333ed241e7d3", default-features = false, features = ["unicode_expressions"] }
1313
anyhow = "1.0"
1414
thiserror = "1.0"
1515
cubeclient = { path = "../cubeclient" }

rust/cubesql/cubesql/src/compile/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ use datafusion::{
1010
plan::{Analyze, Explain, Extension, Projection, ToStringifiedPlan},
1111
DFField, DFSchema, DFSchemaRef, Expr, LogicalPlan, PlanType, PlanVisitor, ToDFSchema,
1212
},
13+
optimizer::{
14+
optimizer::{OptimizerConfig, OptimizerRule},
15+
projection_drop_out::ProjectionDropOut,
16+
},
1317
prelude::*,
1418
scalar::ScalarValue,
1519
sql::{parser::Statement as DFStatement, planner::SqlToRel},
@@ -1230,7 +1234,13 @@ WHERE `TABLE_SCHEMA` = '{}'",
12301234
qtrace.set_df_plan(&plan);
12311235
}
12321236

1233-
let optimized_plan = plan;
1237+
let projection_drop_out_optimizer = ProjectionDropOut::new();
1238+
// TODO: report an error when the plan can't be optimized
1239+
let optimized_plan = projection_drop_out_optimizer
1240+
.optimize(&plan, &OptimizerConfig::new())
1241+
.unwrap_or(plan);
1242+
1243+
//let optimized_plan = plan;
12341244
// ctx.optimize(&plan).map_err(|err| {
12351245
// CompilationError::Internal(format!("Planning optimization error: {}", err))
12361246
// })?;

rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__explain-2.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ expression: "execute_query(\"EXPLAIN VERBOSE SELECT 1+1;\".to_string(),\n
1111
| logical_plan after eliminate_filter | SAME TEXT AS ABOVE |
1212
| logical_plan after common_sub_expression_eliminate | SAME TEXT AS ABOVE |
1313
| logical_plan after eliminate_limit | SAME TEXT AS ABOVE |
14+
| logical_plan after projection_drop_out | SAME TEXT AS ABOVE |
1415
| logical_plan after projection_push_down | SAME TEXT AS ABOVE |
1516
| logical_plan after filter_push_down | SAME TEXT AS ABOVE |
1617
| logical_plan after limit_push_down | SAME TEXT AS ABOVE |

0 commit comments

Comments
 (0)