Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion benchmarks/datafusion-bench/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use std::borrow::Cow;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Instant;
Expand Down Expand Up @@ -110,6 +111,10 @@ struct Args {
#[arg(long, default_value_t = false)]
explain: bool,

/// Execute explained queries and include actual operator cardinalities and timings.
#[arg(long, requires = "explain")]
explain_analyze: bool,

/// Print the selected query indices, one per line, and exit
/// Knowledge of query ids lies only in this binary so we need
/// orchestrator to know whan queries to run one by one.
Expand Down Expand Up @@ -165,6 +170,7 @@ async fn main() -> anyhow::Result<()> {
let collected_plans: Arc<Mutex<Vec<(usize, Format, Arc<dyn ExecutionPlan>)>>> =
Arc::new(Mutex::new(Vec::new()));
let show_metrics = args.show_metrics;
let explain_analyze = args.explain_analyze;

let mode = if args.explain {
BenchmarkMode::Explain
Expand Down Expand Up @@ -197,8 +203,16 @@ async fn main() -> anyhow::Result<()> {

Box::pin(
async move {
let query = if explain_analyze {
Cow::Owned(format!(
"EXPLAIN ANALYZE {}",
query.strip_prefix("EXPLAIN ").unwrap_or(query)
))
} else {
Cow::Borrowed(query)
};
let timer = Instant::now();
let (batches, plan) = execute_query(session, query)
let (batches, plan) = execute_query(session, &query)
.with_labelset(get_labelset_from_global())
.await?;
let time = timer.elapsed();
Expand Down
15 changes: 14 additions & 1 deletion benchmarks/duckdb-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

mod validation;

use std::borrow::Cow;
use std::path::PathBuf;

use clap::Parser;
Expand Down Expand Up @@ -88,6 +89,10 @@ struct Args {
#[arg(long, default_value_t = false)]
explain: bool,

/// Execute explained queries and include actual operator cardinalities and timings.
#[arg(long, requires = "explain")]
explain_analyze: bool,

/// Print the selected query indices, one per line, and exit
/// Knowledge of query ids lies only in this binary so we need
/// orchestrator to know whan queries to run one by one.
Expand Down Expand Up @@ -222,7 +227,15 @@ fn main() -> anyhow::Result<()> {
if !args.reuse {
ctx.reopen()?;
}
ctx.execute_query_result(query)
let query = if args.explain_analyze {
Cow::Owned(format!(
"EXPLAIN ANALYZE {}",
query.strip_prefix("EXPLAIN ").unwrap_or(query)
))
} else {
Cow::Borrowed(query)
};
ctx.execute_query_result(&query)
},
)?;

Expand Down
Loading