Skip to content

Apache DataFusion SQL Query Engine

Stop pretty printing in benchmark when there are no results (#3974)

Andy Grove6860ae455c95
diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rs
index 7a914b19b9..02de551f28 100644
--- a/benchmarks/src/bin/tpch.rs
+++ b/benchmarks/src/bin/tpch.rs
@@ -326,7 +326,11 @@ async fn execute_query(
"=== Physical plan with metrics ===\n{}\n",
DisplayableExecutionPlan::with_metrics(physical_plan.as_ref()).indent()
);
- pretty::print_batches(&result)?;
+ if !result.is_empty() {
+ // do not call print_batches if there are no batches as the result is confusing
+ // and makes it look like there is a batch with no columns
+ pretty::print_batches(&result)?;
+ }
}
Ok(result)
}