Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 6 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async-trait = "0.1.89"
bigdecimal = "0.4.8"
bytes = "1.10"
chrono = { version = "0.4.42", default-features = false }
criterion = "0.5.1"
criterion = "0.7"
ctor = "0.6.1"
dashmap = "6.0.1"
datafusion = { path = "datafusion/core", version = "50.3.0", default-features = false }
Expand Down
4 changes: 3 additions & 1 deletion datafusion/core/benches/aggregate_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ extern crate arrow;
extern crate datafusion;

mod data_utils;

use crate::criterion::Criterion;
use data_utils::create_table_provider;
use datafusion::error::Result;
use datafusion::execution::context::SessionContext;
use parking_lot::Mutex;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

fn query(ctx: Arc<Mutex<SessionContext>>, rt: &Runtime, sql: &str) {
let df = rt.block_on(ctx.lock().sql(sql)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context(
Expand Down
4 changes: 3 additions & 1 deletion datafusion/core/benches/csv_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ extern crate arrow;
extern crate datafusion;

mod data_utils;

use crate::criterion::Criterion;
use datafusion::error::Result;
use datafusion::execution::context::SessionContext;
use datafusion::prelude::CsvReadOptions;
use datafusion::test_util::csv::TestCsvFile;
use parking_lot::Mutex;
use std::hint::black_box;
use std::sync::Arc;
use std::time::Duration;
use test_utils::AccessLogGenerator;
Expand All @@ -39,7 +41,7 @@ fn load_csv(
options: CsvReadOptions,
) {
let df = rt.block_on(ctx.lock().read_csv(path, options)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context() -> Result<Arc<Mutex<SessionContext>>> {
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/benches/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use datafusion::datasource::MemTable;
use datafusion::prelude::SessionContext;
use datafusion_expr::col;
use datafusion_functions::expr_fn::btrim;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

Expand All @@ -45,7 +46,7 @@ fn create_context(field_count: u32) -> datafusion_common::Result<Arc<SessionCont
}

fn run(column_count: u32, ctx: Arc<SessionContext>, rt: &Runtime) {
criterion::black_box(rt.block_on(async {
black_box(rt.block_on(async {
let mut data_frame = ctx.table("t").await.unwrap();

for i in 0..column_count {
Expand Down
6 changes: 3 additions & 3 deletions datafusion/core/benches/distinct_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ use datafusion_execution::config::SessionConfig;
use datafusion_execution::TaskContext;

use parking_lot::Mutex;
use std::hint::black_box;
use std::{sync::Arc, time::Duration};
use tokio::runtime::Runtime;

fn query(ctx: Arc<Mutex<SessionContext>>, rt: &Runtime, sql: &str) {
let df = rt.block_on(ctx.lock().sql(sql)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context(
Expand Down Expand Up @@ -124,8 +125,7 @@ async fn distinct_with_limit(
}

fn run(rt: &Runtime, plan: Arc<dyn ExecutionPlan>, ctx: Arc<TaskContext>) {
criterion::black_box(rt.block_on(distinct_with_limit(plan.clone(), ctx.clone())))
.unwrap();
black_box(rt.block_on(distinct_with_limit(plan.clone(), ctx.clone()))).unwrap();
}

pub async fn create_context_sampled_data(
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/benches/filter_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ use criterion::{criterion_group, criterion_main, Criterion};
use datafusion::prelude::SessionContext;
use datafusion::{datasource::MemTable, error::Result};
use futures::executor::block_on;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

async fn query(ctx: &SessionContext, rt: &Runtime, sql: &str) {
// execute the query
let df = rt.block_on(ctx.sql(sql)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context(array_len: usize, batch_size: usize) -> Result<SessionContext> {
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/benches/map_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
// specific language governing permissions and limitations
// under the License.

use std::hint::black_box;
use std::sync::Arc;

use arrow::array::{ArrayRef, Int32Array, RecordBatch};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};
use parking_lot::Mutex;
use rand::prelude::ThreadRng;
use rand::Rng;
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/benches/spm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use std::hint::black_box;
use std::sync::Arc;

use arrow::array::{ArrayRef, Int32Array, Int64Array, RecordBatch, StringArray};
Expand All @@ -25,7 +26,7 @@ use datafusion_physical_plan::sorts::sort_preserving_merge::SortPreservingMergeE
use datafusion_physical_plan::{collect, ExecutionPlan};

use criterion::async_executor::FuturesExecutor;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};
use datafusion_datasource::memory::MemorySourceConfig;

fn generate_spm_for_round_robin_tie_breaker(
Expand Down
7 changes: 4 additions & 3 deletions datafusion/core/benches/sql_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use datafusion::datasource::MemTable;
use datafusion::execution::context::SessionContext;
use datafusion_common::{config::Dialect, ScalarValue};
use datafusion_expr::col;
use std::hint::black_box;
use std::path::PathBuf;
use std::sync::Arc;
use test_utils::tpcds::tpcds_schemas;
Expand All @@ -43,12 +44,12 @@ const CLICKBENCH_DATA_PATH: &str = "data/hits_partitioned/";

/// Create a logical plan from the specified sql
fn logical_plan(ctx: &SessionContext, rt: &Runtime, sql: &str) {
criterion::black_box(rt.block_on(ctx.sql(sql)).unwrap());
black_box(rt.block_on(ctx.sql(sql)).unwrap());
}

/// Create a physical ExecutionPlan (by way of logical plan)
fn physical_plan(ctx: &SessionContext, rt: &Runtime, sql: &str) {
criterion::black_box(rt.block_on(async {
black_box(rt.block_on(async {
ctx.sql(sql)
.await
.unwrap()
Expand Down Expand Up @@ -145,7 +146,7 @@ fn benchmark_with_param_values_many_columns(
rt.block_on(async { ctx.state().statement_to_plan(statement).await.unwrap() });
b.iter(|| {
let plan = plan.clone();
criterion::black_box(plan.with_param_values(vec![ScalarValue::from(1)]).unwrap());
black_box(plan.with_param_values(vec![ScalarValue::from(1)]).unwrap());
});
}

Expand Down
5 changes: 2 additions & 3 deletions datafusion/core/benches/sql_planner_extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use datafusion_expr::{cast, col, lit, not, try_cast, when};
use datafusion_functions::expr_fn::{
btrim, length, regexp_like, regexp_replace, to_timestamp, upper,
};
use std::hint::black_box;
use std::ops::Rem;
use std::sync::Arc;
use tokio::runtime::Runtime;
Expand Down Expand Up @@ -223,9 +224,7 @@ fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("logical_plan_optimize", |b| {
b.iter(|| {
let df_clone = df.clone();
criterion::black_box(
rt.block_on(async { df_clone.into_optimized_plan().unwrap() }),
);
black_box(rt.block_on(async { df_clone.into_optimized_plan().unwrap() }));
})
});
}
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/benches/struct_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ use criterion::{criterion_group, criterion_main, Criterion};
use datafusion::prelude::SessionContext;
use datafusion::{datasource::MemTable, error::Result};
use futures::executor::block_on;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

async fn query(ctx: &SessionContext, rt: &Runtime, sql: &str) {
// execute the query
let df = rt.block_on(ctx.sql(sql)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context(array_len: usize, batch_size: usize) -> Result<SessionContext> {
Expand Down
8 changes: 4 additions & 4 deletions datafusion/core/benches/topk_aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.

mod data_utils;

use arrow::util::pretty::pretty_format_batches;
use criterion::{criterion_group, criterion_main, Criterion};
use data_utils::make_data;
Expand All @@ -24,6 +25,7 @@ use datafusion::prelude::SessionContext;
use datafusion::{datasource::MemTable, error::Result};
use datafusion_execution::config::SessionConfig;
use datafusion_execution::TaskContext;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

Expand Down Expand Up @@ -57,10 +59,8 @@ async fn create_context(
}

fn run(rt: &Runtime, plan: Arc<dyn ExecutionPlan>, ctx: Arc<TaskContext>, asc: bool) {
criterion::black_box(
rt.block_on(async { aggregate(plan.clone(), ctx.clone(), asc).await }),
)
.unwrap();
black_box(rt.block_on(async { aggregate(plan.clone(), ctx.clone(), asc).await }))
.unwrap();
}

async fn aggregate(
Expand Down
4 changes: 3 additions & 1 deletion datafusion/core/benches/window_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ extern crate arrow;
extern crate datafusion;

mod data_utils;

use crate::criterion::Criterion;
use data_utils::create_table_provider;
use datafusion::error::Result;
use datafusion::execution::context::SessionContext;
use parking_lot::Mutex;
use std::hint::black_box;
use std::sync::Arc;
use tokio::runtime::Runtime;

fn query(ctx: Arc<Mutex<SessionContext>>, rt: &Runtime, sql: &str) {
let df = rt.block_on(ctx.lock().sql(sql)).unwrap();
criterion::black_box(rt.block_on(df.collect()).unwrap());
black_box(rt.block_on(df.collect()).unwrap());
}

fn create_context(
Expand Down
3 changes: 2 additions & 1 deletion datafusion/functions-aggregate/benches/array_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
// specific language governing permissions and limitations
// under the License.

use std::hint::black_box;
use std::sync::Arc;

use arrow::array::{
Array, ArrayRef, ArrowPrimitiveType, AsArray, ListArray, NullBufferBuilder,
PrimitiveArray,
};
use arrow::datatypes::{Field, Int64Type};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};
use datafusion_expr::Accumulator;
use datafusion_functions_aggregate::array_agg::ArrayAggAccumulator;

Expand Down
3 changes: 2 additions & 1 deletion datafusion/functions-aggregate/benches/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use std::hint::black_box;
use std::sync::Arc;

use arrow::array::{ArrayRef, BooleanArray};
Expand All @@ -29,7 +30,7 @@ use datafusion_expr::{Accumulator, AggregateUDFImpl, GroupsAccumulator};
use datafusion_functions_aggregate::count::Count;
use datafusion_physical_expr::expressions::col;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};

fn prepare_group_accumulator() -> Box<dyn GroupsAccumulator> {
let schema = Arc::new(Schema::new(vec![Field::new("f", DataType::Int32, true)]));
Expand Down
Loading
Loading