Skip to content

Commit d02a910

Browse files
committed
chore: sort and dedup formats in sql enginer runner
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 3188e24 commit d02a910

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

vortex-bench/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ impl Display for Target {
124124
}
125125
}
126126

127-
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, ValueEnum, Serialize, Deserialize)]
127+
#[derive(
128+
Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Serialize, Deserialize,
129+
)]
128130
#[serde(rename_all = "kebab-case")]
129131
pub enum Format {
130132
#[clap(name = "csv")]

vortex-bench/src/runner.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
//! Generic benchmark runner infrastructure to reduce boilerplate across engine-specific benchmarks.
55
6+
use std::collections::BTreeSet;
67
use std::fs::File;
78
use std::future::Future;
89
use std::io::Write;
@@ -67,7 +68,8 @@ pub struct SqlBenchmarkRunner {
6768
benchmark_dataset: BenchmarkDataset,
6869
storage: String,
6970
expected_row_counts: Option<Vec<usize>>,
70-
formats: Vec<Format>,
71+
/// Deduplicated and deterministically ordered.
72+
formats: BTreeSet<Format>,
7173
memory_tracker: Option<BenchmarkMemoryTracker>,
7274
hide_progress_bar: bool,
7375
query_measurements: Vec<QueryMeasurement>,
@@ -79,10 +81,11 @@ impl SqlBenchmarkRunner {
7981
pub fn new<B: Benchmark + ?Sized>(
8082
benchmark: &B,
8183
engine: Engine,
82-
formats: Vec<Format>,
84+
formats: impl IntoIterator<Item = Format>,
8385
track_memory: bool,
8486
hide_progress_bar: bool,
8587
) -> anyhow::Result<Self> {
88+
let formats: BTreeSet<Format> = formats.into_iter().collect();
8689
let storage = url_scheme_to_storage(benchmark.data_url())?;
8790

8891
let memory_tracker = track_memory.then(BenchmarkMemoryTracker::new);
@@ -101,7 +104,7 @@ impl SqlBenchmarkRunner {
101104
}
102105

103106
/// Get the formats to run benchmarks for.
104-
pub fn formats(&self) -> &[Format] {
107+
pub fn formats(&self) -> &BTreeSet<Format> {
105108
&self.formats
106109
}
107110

@@ -412,7 +415,7 @@ pub fn export_results<W: Write>(
412415
memory: Vec<MemoryMeasurement>,
413416
display_format: &DisplayFormat,
414417
engine: Engine,
415-
formats: &[Format],
418+
formats: &BTreeSet<Format>,
416419
mut output: W,
417420
) -> anyhow::Result<()> {
418421
let targets = formats

0 commit comments

Comments
 (0)