| 23 | use std::sync::Arc; |
| 24 | |
| 25 | fn make_record_batch(column_count: usize, row_count: usize) -> RecordBatch { |
| 26 | let fields = (0..column_count) |
| 27 | .map(|i| Field::new(format!("col_{}", i), DataType::Int64, i.is_even())) |
| 28 | .collect::<Vec<_>>(); |
| 29 | |
| 30 | let columns = fields |
| 31 | .iter() |
| 32 | .map(|_| { |
| 33 | let array_ref: ArrayRef = Arc::new(Int64Array::from_value(0, row_count)); |
| 34 | array_ref |
| 35 | }) |
| 36 | .collect::<Vec<_>>(); |
| 37 | |
| 38 | let schema = Schema::new(fields); |
| 39 | |
| 40 | let mut options = RecordBatchOptions::new(); |
| 41 | options.row_count = Some(row_count); |
| 42 | |
| 43 | RecordBatch::try_new_with_options(SchemaRef::new(schema), columns, &options).unwrap() |
| 44 | } |
| 45 | |
| 46 | fn project_benchmark( |
| 47 | c: &mut Criterion, |