|
16 | 16 | // under the License. |
17 | 17 | extern crate arrow; |
18 | 18 |
|
19 | | -use arrow::compute::Filter; |
| 19 | +use std::sync::Arc; |
| 20 | + |
| 21 | +use arrow::compute::{filter_record_batch, Filter}; |
| 22 | +use arrow::record_batch::RecordBatch; |
20 | 23 | use arrow::util::bench_util::*; |
21 | 24 |
|
22 | 25 | use arrow::array::*; |
23 | 26 | use arrow::compute::{build_filter, filter}; |
24 | | -use arrow::datatypes::{Float32Type, UInt8Type}; |
| 27 | +use arrow::datatypes::{Field, Float32Type, Schema, UInt8Type}; |
25 | 28 |
|
26 | 29 | use criterion::{criterion_group, criterion_main, Criterion}; |
27 | 30 |
|
@@ -100,6 +103,18 @@ fn add_benchmark(c: &mut Criterion) { |
100 | 103 | c.bench_function("filter context string low selectivity", |b| { |
101 | 104 | b.iter(|| bench_built_filter(&sparse_filter, &data_array)) |
102 | 105 | }); |
| 106 | + |
| 107 | + let data_array = create_primitive_array::<Float32Type>(size, 0.0); |
| 108 | + |
| 109 | + let field = Field::new("c1", data_array.data_type().clone(), true); |
| 110 | + let schema = Schema::new(vec![field]); |
| 111 | + |
| 112 | + let batch = |
| 113 | + RecordBatch::try_new(Arc::new(schema), vec![Arc::new(data_array)]).unwrap(); |
| 114 | + |
| 115 | + c.bench_function("filter single record batch", |b| { |
| 116 | + b.iter(|| filter_record_batch(&batch, &filter_array)) |
| 117 | + }); |
103 | 118 | } |
104 | 119 |
|
105 | 120 | criterion_group!(benches, add_benchmark); |
|
0 commit comments