Skip to content

Commit 928eb9a

Browse files
committed
Explain the reasoning for not using optimized_plan in tests
1 parent 8b2b1e4 commit 928eb9a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • datafusion/core/tests/sql

datafusion/core/tests/sql/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,11 @@ async fn execute_to_batches(ctx: &SessionContext, sql: &str) -> Vec<RecordBatch>
765765
.unwrap();
766766
let logical_schema = plan.schema();
767767

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

0 commit comments

Comments
 (0)