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

Method run

datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs:192–238  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

190 }
191
192 pub async fn run(&mut self) -> Result<()> {
193 let start_time = Instant::now();
194
195 // Execute until either`max_rounds` or `time_limit` is reached
196 let max_rounds = self.max_rounds.unwrap_or(usize::MAX);
197 for round in 0..max_rounds {
198 let init_seed = self.runner_rng.random();
199 for query_i in 0..self.queries_per_round {
200 let query_seed = self.runner_rng.random();
201 let mut expected_results: Option<Vec<RecordBatch>> = None; // use first config's result as the expected result
202 for config_i in 0..self.config_variations_per_query {
203 if self.should_stop_due_to_time_limit(start_time, round, query_i) {
204 return Ok(());
205 }
206
207 let config_seed = self.runner_rng.random();
208
209 println!(
210 "[SortQueryFuzzer] Round {round}, Query {query_i} (Config {config_i})"
211 );
212 println!(" Seeds:");
213 println!(" init_seed = {init_seed}");
214 println!(" query_seed = {query_seed}");
215 println!(" config_seed = {config_seed}");
216
217 let results = self
218 .test_gen
219 .fuzzer_run(init_seed, query_seed, config_seed)
220 .await?;
221 println!("\n"); // Separator between tested runs
222
223 if expected_results.is_none() {
224 expected_results = Some(results);
225 } else if let Some(ref expected) = expected_results {
226 // `fuzzer_run` might append `LIMIT k` to either the
227 // expected or actual query. The number of results is
228 // checked inside `fuzzer_run()`. Here we only check
229 // that the first k rows of each result are consistent.
230 check_equality_of_batches(expected, &results).unwrap();
231 } else {
232 unreachable!();
233 }
234 }
235 }
236 }
237 Ok(())
238 }
239}
240
241/// Struct to generate and manage a random dataset for fuzz testing.

Callers 8

sort_query_fuzzer_runnerFunction · 0.45
test_minFunction · 0.45
test_first_valFunction · 0.45
test_last_valFunction · 0.45
test_maxFunction · 0.45
test_sumFunction · 0.45
test_countFunction · 0.45
test_medianFunction · 0.45

Calls 4

fuzzer_runMethod · 0.80
is_noneMethod · 0.80

Tested by

no test coverage detected