Skip to content

Commit 5b92197

Browse files
committed
Refactor topk aggregate tests to use constant for row limit
1 parent 049b06e commit 5b92197

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

datafusion/core/benches/topk_aggregate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ use std::hint::black_box;
2828
use std::sync::Arc;
2929
use tokio::runtime::Runtime;
3030

31+
const LIMIT: usize = 10;
32+
3133
async fn create_context(
3234
partition_cnt: i32,
3335
sample_cnt: i32,
@@ -77,7 +79,7 @@ async fn aggregate(
7779
let batches = collect(plan, ctx.task_ctx()).await?;
7880
assert_eq!(batches.len(), 1);
7981
let batch = batches.first().unwrap();
80-
assert_eq!(batch.num_rows(), 10);
82+
assert_eq!(batch.num_rows(), LIMIT);
8183

8284
let actual = format!("{}", pretty_format_batches(&batches)?).to_lowercase();
8385
let expected_asc = r#"
@@ -126,14 +128,14 @@ async fn aggregate_string(
126128
let batches = collect(plan, ctx.task_ctx()).await?;
127129
assert_eq!(batches.len(), 1);
128130
let batch = batches.first().unwrap();
129-
assert_eq!(batch.num_rows(), 10);
131+
assert_eq!(batch.num_rows(), LIMIT);
130132

131133
Ok(())
132134
}
133135

134136
fn criterion_benchmark(c: &mut Criterion) {
135137
let rt = Runtime::new().unwrap();
136-
let limit = 10;
138+
let limit = LIMIT;
137139
let partitions = 10;
138140
let samples = 1_000_000;
139141

0 commit comments

Comments
 (0)