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

Function list_array

datafusion/common/benches/with_hashes.rs:371–389  ·  view source on GitHub ↗
(num_rows: usize)

Source from the content-addressed store, hash-verified

369}
370
371fn list_array(num_rows: usize) -> ArrayRef {
372 let mut rng = make_rng();
373 let elements_per_row = 5;
374 let total_elements = num_rows * elements_per_row;
375
376 let values: Int64Array = (0..total_elements)
377 .map(|_| Some(rng.random::<i64>()))
378 .collect();
379 let offsets: Vec<i32> = (0..=num_rows)
380 .map(|i| (i * elements_per_row) as i32)
381 .collect();
382
383 Arc::new(ListArray::new(
384 Arc::new(Field::new("item", DataType::Int64, true)),
385 OffsetBuffer::new(ScalarBuffer::from(offsets)),
386 Arc::new(values),
387 None,
388 ))
389}
390
391fn map_array(num_rows: usize) -> ArrayRef {
392 let mut rng = make_rng();

Callers 2

criterion_benchmarkFunction · 0.70
sliced_array_benchmarkFunction · 0.70

Calls 4

make_rngFunction · 0.85
newFunction · 0.85
collectMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…