Skip to content

Commit c17ff9e

Browse files
committed
do this right
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 5c70d76 commit c17ff9e

1 file changed

Lines changed: 31 additions & 34 deletions

File tree

  • benchmarks/datafusion-bench/src

benchmarks/datafusion-bench/src/main.rs

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -253,42 +253,39 @@ async fn register_benchmark_tables<B: Benchmark + ?Sized>(
253253
benchmark: &B,
254254
format: Format,
255255
) -> anyhow::Result<()> {
256-
match format {
257-
_ if use_scan_api() && matches!(format, Format::OnDiskVortex | Format::VortexCompact) => {
258-
register_v2_tables(session, benchmark, format).await
256+
if use_scan_api() && matches!(format, Format::OnDiskVortex | Format::VortexCompact) {
257+
register_v2_tables(session, benchmark, format).await
258+
} else {
259+
let benchmark_base = benchmark.data_url().join(&format!("{}/", format.name()))?;
260+
let file_format = format_to_df_format(format);
261+
262+
for table in benchmark.table_specs().iter() {
263+
let pattern = benchmark.pattern(table.name, format);
264+
let table_url = ListingTableUrl::try_new(benchmark_base.clone(), pattern)?;
265+
266+
let listing_options = ListingOptions::new(Arc::clone(&file_format))
267+
.with_session_config_options(session.state().config());
268+
let mut config =
269+
ListingTableConfig::new(table_url).with_listing_options(listing_options);
270+
271+
config = match table.schema.as_ref() {
272+
Some(schema) => config.with_schema(Arc::new(schema.clone())),
273+
None => config.infer_schema(&session.state()).await?,
274+
};
275+
276+
let listing_table = Arc::new(
277+
ListingTable::try_new(config)?.with_cache(
278+
session
279+
.runtime_env()
280+
.cache_manager
281+
.get_file_statistic_cache(),
282+
),
283+
);
284+
285+
session.register_table(table.name, listing_table)?;
259286
}
260-
_ => {
261-
let benchmark_base = benchmark.data_url().join(&format!("{}/", format.name()))?;
262-
let file_format = format_to_df_format(format);
263-
264-
for table in benchmark.table_specs().iter() {
265-
let pattern = benchmark.pattern(table.name, format);
266-
let table_url = ListingTableUrl::try_new(benchmark_base.clone(), pattern)?;
267-
268-
let listing_options = ListingOptions::new(Arc::clone(&file_format))
269-
.with_session_config_options(session.state().config());
270-
let mut config =
271-
ListingTableConfig::new(table_url).with_listing_options(listing_options);
272-
273-
config = match table.schema.as_ref() {
274-
Some(schema) => config.with_schema(Arc::new(schema.clone())),
275-
None => config.infer_schema(&session.state()).await?,
276-
};
277-
278-
let listing_table = Arc::new(
279-
ListingTable::try_new(config)?.with_cache(
280-
session
281-
.runtime_env()
282-
.cache_manager
283-
.get_file_statistic_cache(),
284-
),
285-
);
286-
287-
session.register_table(table.name, listing_table)?;
288-
}
289287

290-
Ok(())
291-
}
288+
Ok(())
292289
}
293290
}
294291

0 commit comments

Comments
 (0)