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

Function flat_batch

datafusion/core/benches/parquet_struct_projection.rs:415–436  ·  view source on GitHub ↗
(batch_id: usize)

Source from the content-addressed store, hash-verified

413}
414
415fn flat_batch(batch_id: usize) -> RecordBatch {
416 let schema = flat_schema();
417 let len = WRITE_RECORD_BATCH_SIZE;
418
419 let base_id = (batch_id * len) as i32;
420 let id_values: Vec<i32> = (0..len).map(|i| base_id + i as i32).collect();
421 let id_array = Arc::new(Int32Array::from(id_values.clone()));
422 let small_int_array = Arc::new(Int32Array::from(id_values));
423
424 let large_string: String = "x".repeat(LARGE_STRING_LEN);
425 let mut string_builder = StringBuilder::new();
426 for _ in 0..len {
427 string_builder.append_value(&large_string);
428 }
429 let large_string_array = Arc::new(string_builder.finish());
430
431 RecordBatch::try_new(
432 schema,
433 vec![id_array, large_string_array as ArrayRef, small_int_array],
434 )
435 .unwrap()
436}
437
438/// Compare selecting a small field from a flat (top-level) schema vs from
439/// inside a struct. Both files contain the same logical data — the only

Callers

nothing calls this directly

Calls 7

flat_schemaFunction · 0.85
newFunction · 0.85
collectMethod · 0.80
mapMethod · 0.45
cloneMethod · 0.45
append_valueMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…