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

Function generate_binary_data

datafusion/spark/benches/hex.rs:64–77  ·  view source on GitHub ↗
(size: usize, null_density: f32)

Source from the content-addressed store, hash-verified

62}
63
64fn generate_binary_data(size: usize, null_density: f32) -> BinaryArray {
65 let mut rng = seedable_rng();
66 let mut builder = BinaryBuilder::new();
67 for _ in 0..size {
68 if rng.random::<f32>() < null_density {
69 builder.append_null();
70 } else {
71 let len = rng.random_range::<usize, _>(1..=100);
72 let bytes: Vec<u8> = (0..len).map(|_| rng.random()).collect();
73 builder.append_value(&bytes);
74 }
75 }
76 builder.finish()
77}
78
79fn generate_int64_dict_data(
80 size: usize,

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…