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

Function sparse_union_array

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

Source from the content-addressed store, hash-verified

430}
431
432fn sparse_union_array(num_rows: usize) -> ArrayRef {
433 let mut rng = make_rng();
434 let num_types = 5;
435
436 let type_ids: Vec<i8> = (0..num_rows)
437 .map(|_| rng.random_range(0..num_types) as i8)
438 .collect();
439 let (fields, children): (Vec<_>, Vec<_>) = (0..num_types)
440 .map(|i| {
441 (
442 (
443 i as i8,
444 Arc::new(Field::new(format!("f{i}"), DataType::Int64, true)),
445 ),
446 primitive_array::<Int64Type>(num_rows),
447 )
448 })
449 .unzip();
450
451 Arc::new(
452 UnionArray::try_new(
453 UnionFields::from_iter(fields),
454 ScalarBuffer::from(type_ids),
455 None,
456 children,
457 )
458 .unwrap(),
459 )
460}
461
462fn dense_union_array(num_rows: usize) -> ArrayRef {
463 let mut rng = make_rng();

Callers 2

criterion_benchmarkFunction · 0.85
sliced_array_benchmarkFunction · 0.85

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…