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

Method next

test-utils/src/data_gen.rs:344–381  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

342 type Item = RecordBatch;
343
344 fn next(&mut self) -> Option<Self::Item> {
345 if self.row_count == self.options.row_limit {
346 return None;
347 }
348
349 let row_limit = self
350 .max_batch_size
351 .min(self.options.row_limit - self.row_count);
352
353 let mut builder = BatchBuilder {
354 options: GeneratorOptions {
355 row_limit,
356 ..self.options.clone()
357 },
358 ..Default::default()
359 };
360
361 let host = format!(
362 "i-{:016x}.ec2.internal",
363 self.host_idx * 0x7d87f8ed5c5 + 0x1ec3ca3151468928
364 );
365 self.host_idx += 1;
366
367 for service in &["frontend", "backend", "database", "cache"] {
368 if self.rng.random_bool(0.5) {
369 continue;
370 }
371 if builder.is_finished() {
372 break;
373 }
374 builder.append(&mut self.rng, &host, service);
375 }
376
377 let batch = builder.finish(Arc::clone(&self.schema));
378
379 self.row_count += batch.num_rows();
380 Some(batch)
381 }
382}

Callers

nothing calls this directly

Calls 5

minMethod · 0.45
cloneMethod · 0.45
is_finishedMethod · 0.45
appendMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected