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

Function create_fsb_array

arrow/src/util/bench_util.rs:740–758  ·  view source on GitHub ↗

Creates an random (but fixed-seeded) array of a given size and null density

(size: usize, null_density: f32, value_len: usize)

Source from the content-addressed store, hash-verified

738
739/// Creates an random (but fixed-seeded) array of a given size and null density
740pub fn create_fsb_array(size: usize, null_density: f32, value_len: usize) -> FixedSizeBinaryArray {
741 let rng = &mut seedable_rng();
742
743 FixedSizeBinaryArray::try_from_sparse_iter_with_size(
744 (0..size).map(|_| {
745 if rng.random::<f32>() < null_density {
746 None
747 } else {
748 let value = rng
749 .sample_iter::<u8, _>(StandardUniform)
750 .take(value_len)
751 .collect::<Vec<u8>>();
752 Some(value)
753 }
754 }),
755 value_len as i32,
756 )
757 .unwrap()
758}
759
760/// Creates a random (but fixed-seeded) dictionary array of a given size and null density
761/// with the provided values array

Callers 4

add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
add_benchmarkFunction · 0.85
create_random_arrayFunction · 0.85

Calls 2

seedable_rngFunction · 0.70
takeMethod · 0.45

Tested by

no test coverage detected