Skip to content

Commit 24a6ec9

Browse files
committed
Fix table output for random access benchmark
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent c54ce7e commit 24a6ec9

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

  • benchmarks/random-access-bench/src

benchmarks/random-access-bench/src/main.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,13 @@ fn format_to_engine(format: Format) -> Engine {
313313
}
314314
}
315315

316+
fn table_targets(formats: &[Format]) -> Vec<Target> {
317+
formats
318+
.iter()
319+
.map(|format| Target::new(format_to_engine(*format), *format))
320+
.collect()
321+
}
322+
316323
/// Open a random accessor for any supported format.
317324
///
318325
/// For Vortex and Parquet, the path comes from [`BenchDataset::path`].
@@ -385,7 +392,7 @@ async fn run_random_access(
385392
.sum();
386393
let progress = ProgressBar::new(total_steps as u64);
387394

388-
let mut targets = Vec::new();
395+
let targets = table_targets(&formats);
389396
let mut measurements = Vec::new();
390397
let mut v3_records: Vec<v3::V3Record> = Vec::new();
391398

@@ -417,7 +424,6 @@ async fn run_random_access(
417424
None,
418425
reopen,
419426
);
420-
targets.push(measurement.target);
421427
measurements.push(measurement);
422428
progress.inc(1);
423429
}
@@ -450,7 +456,6 @@ async fn run_random_access(
450456
Some(*pattern),
451457
reopen,
452458
);
453-
targets.push(measurement.target);
454459
measurements.push(measurement);
455460
progress.inc(1);
456461
}
@@ -531,4 +536,17 @@ mod tests {
531536
other => panic!("expected random-access record, got {other:?}"),
532537
}
533538
}
539+
540+
#[test]
541+
fn table_targets_has_one_column_per_format() {
542+
let targets = table_targets(&[Format::Parquet, Format::OnDiskVortex]);
543+
544+
assert_eq!(
545+
targets,
546+
vec![
547+
Target::new(Engine::Arrow, Format::Parquet),
548+
Target::new(Engine::Vortex, Format::OnDiskVortex),
549+
]
550+
);
551+
}
534552
}

0 commit comments

Comments
 (0)