|
15 | 15 | // specific language governing permissions and limitations |
16 | 16 | // under the License. |
17 | 17 |
|
18 | | -use arrow::array::ArrayRef; |
| 18 | +use arrow::array::{ArrayRef, BooleanBufferBuilder}; |
19 | 19 | use arrow::datatypes::{Int32Type, StringViewType}; |
20 | 20 | use arrow::util::bench_util::{ |
21 | 21 | create_primitive_array, create_string_view_array_with_len, |
@@ -289,13 +289,16 @@ fn vectorized_equal_to<GroupColumnBuilder: GroupColumn>( |
289 | 289 | builder.vectorized_append(input, rows).unwrap(); |
290 | 290 |
|
291 | 291 | b.iter(|| { |
292 | | - // Cloning is a must as `vectorized_equal_to` will modify the input vec |
293 | | - // and without cloning all benchmarks after the first one won't be meaningful |
294 | | - let mut equal_to_results = equal_to_results.clone(); |
295 | | - builder.vectorized_equal_to(rows, input, rows, &mut equal_to_results); |
| 292 | + // Rebuilding is a must as `vectorized_equal_to` will modify the input |
| 293 | + // and without rebuilding all benchmarks after the first one won't be meaningful |
| 294 | + let mut equal_to_buffer = BooleanBufferBuilder::new(equal_to_results.len()); |
| 295 | + for &value in &equal_to_results { |
| 296 | + equal_to_buffer.append(value); |
| 297 | + } |
| 298 | + builder.vectorized_equal_to(rows, input, rows, &mut equal_to_buffer); |
296 | 299 |
|
297 | 300 | // Make sure that the compiler does not optimize away the call |
298 | | - black_box(equal_to_results); |
| 301 | + black_box(equal_to_buffer); |
299 | 302 | }); |
300 | 303 | }); |
301 | 304 | } |
|
0 commit comments