MCPcopy Create free account
hub / github.com/apache/datafusion / create_record_batch

Function create_record_batch

datafusion/physical-expr/benches/binary_op.rs:290–310  ·  view source on GitHub ↗
(
    schema: Arc<Schema>,
    b_values: &[String],
    c_values: &[String],
)

Source from the content-addressed store, hash-verified

288/// When TEST_ALL_FALSE = false: creates data for OR operator benchmarks (needs early true exit)
289#[expect(clippy::needless_pass_by_value)]
290fn 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
312criterion_group!(benches, benchmark_binary_op_in_short_circuit);
313

Callers

nothing calls this directly

Calls 4

to_vecMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…