| 288 | /// When TEST_ALL_FALSE = false: creates data for OR operator benchmarks (needs early true exit) |
| 289 | #[expect(clippy::needless_pass_by_value)] |
| 290 | fn create_record_batch<const TEST_ALL_FALSE: bool>( |
| 291 | schema: Arc<Schema>, |
| 292 | b_values: &[String], |
| 293 | c_values: &[String], |
| 294 | ) -> arrow::error::Result<Vec<(String, RecordBatch)>> { |
| 295 | // Generate data for six scenarios, but only the data for the "all_false" and "all_true" cases can be optimized through short-circuiting |
| 296 | let boolean_array = generate_boolean_cases::<TEST_ALL_FALSE>(b_values.len()); |
| 297 | let mut rbs = Vec::with_capacity(boolean_array.len()); |
| 298 | for (name, a_array) in boolean_array { |
| 299 | let b_array = StringArray::from(b_values.to_vec()); |
| 300 | let c_array = StringArray::from(c_values.to_vec()); |
| 301 | rbs.push(( |
| 302 | name, |
| 303 | RecordBatch::try_new( |
| 304 | schema.clone(), |
| 305 | vec![Arc::new(a_array), Arc::new(b_array), Arc::new(c_array)], |
| 306 | )?, |
| 307 | )); |
| 308 | } |
| 309 | Ok(rbs) |
| 310 | } |
| 311 | |
| 312 | criterion_group!(benches, benchmark_binary_op_in_short_circuit); |
| 313 | |