MCPcopy Create free account
hub / github.com/apache/datafusion / benchmark_query

Method benchmark_query

benchmarks/src/dict.rs:361–384  ·  view source on GitHub ↗
(
        &self,
        query: &DictionaryQuery,
        ctx: &SessionContext,
    )

Source from the content-addressed store, hash-verified

359 }
360
361 async fn benchmark_query(
362 &self,
363 query: &DictionaryQuery,
364 ctx: &SessionContext,
365 ) -> Result<Vec<QueryResult>> {
366 let batch = self.make_record_batch(query)?;
367 ctx.deregister_table("test_data")?;
368 ctx.register_batch("test_data", batch)?;
369
370 let mut query_results = vec![];
371 for i in 0..self.common.iterations {
372 let start = Instant::now();
373 let row_count =
374 Self::execute_query_without_result_buffering(query.sql, ctx).await?;
375 let elapsed = start.elapsed();
376 println!(
377 "Query '{}' iteration {i} returned {row_count} rows in {elapsed:?}",
378 query.name
379 );
380 query_results.push(QueryResult { elapsed, row_count });
381 }
382
383 Ok(query_results)
384 }
385
386 fn make_record_batch(&self, query: &DictionaryQuery) -> Result<RecordBatch> {
387 let size = self.num_rows;

Callers 1

runMethod · 0.45

Calls 4

make_record_batchMethod · 0.80
deregister_tableMethod · 0.45
register_batchMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected