From 1cdd54a93725ed09b00ea5a99e111bead39062f7 Mon Sep 17 00:00:00 2001 From: ask Date: Wed, 8 Feb 2023 16:27:47 -0500 Subject: [PATCH] fix take_run benchmark paraeter --- arrow/benches/primitive_run_take.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arrow/benches/primitive_run_take.rs b/arrow/benches/primitive_run_take.rs index 8c9a3fd04b7a..82ff35949e79 100644 --- a/arrow/benches/primitive_run_take.rs +++ b/arrow/benches/primitive_run_take.rs @@ -24,14 +24,14 @@ use arrow_array::UInt32Array; use criterion::{criterion_group, criterion_main, Criterion}; use rand::Rng; -fn create_random_index(size: usize, null_density: f32) -> UInt32Array { +fn create_random_index(size: usize, null_density: f32, max_value: usize) -> UInt32Array { let mut rng = seedable_rng(); let mut builder = UInt32Builder::with_capacity(size); for _ in 0..size { if rng.gen::() < null_density { builder.append_null(); } else { - let value = rng.gen_range::(0u32..size as u32); + let value = rng.gen_range::(0u32..max_value as u32); builder.append_value(value); } } @@ -48,7 +48,7 @@ fn criterion_benchmark(c: &mut Criterion) { logical_array_len, physical_array_len, ); - let indices = create_random_index(take_len, 0.0); + let indices = create_random_index(take_len, 0.0, logical_array_len); group.bench_function( format!( "(run_array_len:{logical_array_len}, physical_array_len:{physical_array_len}, take_len:{take_len})"),