Skip to content

Commit

Permalink
Explain the reasoning for not using optimized_plan in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isidentical committed Sep 12, 2022
1 parent 8b2b1e4 commit 928eb9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datafusion/core/tests/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,11 @@ async fn execute_to_batches(ctx: &SessionContext, sql: &str) -> Vec<RecordBatch>
.unwrap();
let logical_schema = plan.schema();

// We are not really interested in the direct output of optimized_logical_plan
// since the physical plan construction already optimizes the given logical plan
// and we want to avoid double-optimization as a consequence. So we just construct
// it here to make sure that it doesn't fail at this step and get the optimized
// schema (to assert later that the logical and optimized schemas are the same).
let msg = format!("Optimizing logical plan for '{}': {:?}", sql, plan);
let optimized_logical_plan = ctx
.optimize(&plan)
Expand Down

0 comments on commit 928eb9a

Please sign in to comment.