Skip to content

Apache DataFusion SQL Query Engine

Update TPC-H benchmark to show physical plan when debug mode is enabled (#386)

Andy Grove7359e4b4df08
diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rs
index cee555fe67..433bf2d269 100644
--- a/benchmarks/src/bin/tpch.rs
+++ b/benchmarks/src/bin/tpch.rs
@@ -38,7 +38,7 @@ use datafusion::datasource::parquet::ParquetTable;
use datafusion::datasource::{CsvFile, MemTable, TableProvider};
use datafusion::error::{DataFusionError, Result};
use datafusion::logical_plan::LogicalPlan;
-use datafusion::physical_plan::collect;
+use datafusion::physical_plan::{collect, displayable};
use datafusion::prelude::*;
use datafusion::parquet::basic::Compression;
@@ -310,6 +310,12 @@ async fn execute_query(
println!("Optimized logical plan:\n{:?}", plan);
}
let physical_plan = ctx.create_physical_plan(&plan)?;
+ if debug {
+ println!(
+ "Physical plan:\n{}",
+ displayable(physical_plan.as_ref()).indent().to_string()
+ );
+ }
let result = collect(physical_plan).await?;
if debug {
pretty::print_batches(&result)?;