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

Method new_f64

datafusion/core/tests/fuzz_cases/limit_fuzz.rs:120–140  ·  view source on GitHub ↗

Create an f64 column of random values, with the specified number of rows, sorted the default

(size: usize)

Source from the content-addressed store, hash-verified

118 /// Create an f64 column of random values, with the specified number of
119 /// rows, sorted the default
120 fn new_f64(size: usize) -> Self {
121 let mut rng = rng();
122 let mut data: Vec<Option<f64>> = (0..size / 3)
123 .map(|_| {
124 // no nulls for now
125 Some(rng.random_range(0.0..1.0f64))
126 })
127 .collect();
128
129 // have some repeats (approximately 1/3 of the values are the same)
130 while data.len() < size {
131 data.push(data[rng.random_range(0..data.len())]);
132 }
133
134 let batches = stagger_batch(f64_batch(data.iter().cloned()));
135
136 let mut sorted = data;
137 sorted.sort_by(|a, b| a.partial_cmp(b).unwrap());
138
139 Self::F64 { batches, sorted }
140 }
141
142 /// Create an string column of random values, with the specified number of
143 /// rows, sorted the default

Callers

nothing calls this directly

Calls 10

stagger_batchFunction · 0.85
f64_batchFunction · 0.85
collectMethod · 0.80
mapMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45
clonedMethod · 0.45
iterMethod · 0.45
sort_byMethod · 0.45
partial_cmpMethod · 0.45

Tested by

no test coverage detected