33
44//! Generic benchmark runner infrastructure to reduce boilerplate across engine-specific benchmarks.
55
6+ use std:: collections:: BTreeSet ;
67use std:: fs:: File ;
78use std:: future:: Future ;
89use 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