Skip to content
Open
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
65 changes: 65 additions & 0 deletions datafusion/core/benches/window_query_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});

c.bench_function("window order by and range offsets, aggregate functions", |b| {
b.iter(|| {
query(
ctx.clone(),
&rt,
"SELECT \
MAX(f64) OVER (ORDER BY u64_narrow RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
MIN(f32) OVER (ORDER BY u64_narrow DESC RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
SUM(u64_narrow) OVER (ORDER BY u64_narrow ASC RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING) \
FROM t",
)
})
});

c.bench_function("window order by, built-in functions", |b| {
b.iter(|| {
query(
Expand Down Expand Up @@ -182,6 +196,23 @@ fn criterion_benchmark(c: &mut Criterion) {
},
);

c.bench_function(
"window partition and order by and range offsets, u64_wide, aggregate functions",
|b| {
b.iter(|| {
query(
ctx.clone(),
&rt,
"SELECT \
MAX(f64) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
MIN(f32) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
SUM(u64_narrow) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING) \
FROM t",
)
})
},
);

c.bench_function(
"window partition and order by, u64_narrow, aggregate functions",
|b| {
Expand All @@ -199,6 +230,23 @@ fn criterion_benchmark(c: &mut Criterion) {
},
);

c.bench_function(
"window partition and order by and range offsets, u64_narrow, aggregate functions",
|b| {
b.iter(|| {
query(
ctx.clone(),
&rt,
"SELECT \
MAX(f64) OVER (PARTITION BY u64_narrow ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
MIN(f32) OVER (PARTITION BY u64_narrow ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
SUM(u64_narrow) OVER (PARTITION BY u64_narrow ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING) \
FROM t",
)
})
},
);

c.bench_function(
"window partition and order by, u64_wide, built-in functions",
|b| {
Expand Down Expand Up @@ -232,6 +280,23 @@ fn criterion_benchmark(c: &mut Criterion) {
})
},
);

c.bench_function(
"window partition and order by and range offsets, u64_wide, aggregate functions",
|b| {
b.iter(|| {
query(
ctx.clone(),
&rt,
"SELECT \
MAX(f64) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
MIN(f32) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING), \
SUM(u64_narrow) OVER (PARTITION BY u64_wide ORDER by f64 RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING) \
FROM t",
)
})
},
);
}

criterion_group!(benches, criterion_benchmark);
Expand Down
Loading
Loading