MCPcopy Create free account
hub / github.com/apache/arrow-rs / array_with_nulls

Function array_with_nulls

arrow-array/benches/union_array.rs:26–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24use rand::{Rng, rng};
25
26fn array_with_nulls() -> ArrayRef {
27 let mut rng = rng();
28
29 let values = ScalarBuffer::from_iter(repeat_with(|| rng.random()).take(4096));
30
31 // nulls with at least one null and one valid
32 let nulls: NullBuffer = [true, false]
33 .into_iter()
34 .chain(repeat_with(|| rng.random()))
35 .take(4096)
36 .collect();
37
38 Arc::new(Int32Array::new(values.clone(), Some(nulls)))
39}
40
41fn array_without_nulls() -> ArrayRef {
42 let mut rng = rng();

Callers 1

criterion_benchmarkFunction · 0.85

Calls 6

randomMethod · 0.80
collectMethod · 0.80
from_iterFunction · 0.50
takeMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected