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

Function generate_binary_data

datafusion/spark/benches/sha2.rs:34–47  ·  view source on GitHub ↗
(size: usize, null_density: f32)

Source from the content-addressed store, hash-verified

32}
33
34fn generate_binary_data(size: usize, null_density: f32) -> BinaryArray {
35 let mut rng = seedable_rng();
36 let mut builder = BinaryBuilder::new();
37 for _ in 0..size {
38 if rng.random::<f32>() < null_density {
39 builder.append_null();
40 } else {
41 let len = rng.random_range::<usize, _>(1..=100);
42 let bytes: Vec<u8> = (0..len).map(|_| rng.random()).collect();
43 builder.append_value(&bytes);
44 }
45 }
46 builder.finish()
47}
48
49fn run_benchmark(c: &mut Criterion, name: &str, size: usize, args: &[ColumnarValue]) {
50 let sha2_func = SparkSha2::new();

Callers 1

criterion_benchmarkFunction · 0.70

Calls 7

newFunction · 0.85
collectMethod · 0.80
seedable_rngFunction · 0.70
append_nullMethod · 0.45
mapMethod · 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…