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

Method process_file

benchmarks/src/sql_benchmark.rs:478–509  ·  view source on GitHub ↗
(&mut self, ctx: &SessionContext, path: &Path)

Source from the content-addressed store, hash-verified

476 }
477
478 async fn process_file(&mut self, ctx: &SessionContext, path: &Path) -> Result<()> {
479 debug!("Processing file {}", path.display());
480
481 let mut replacement_mapping = self.replacement_mapping.clone();
482 insert_replacement(
483 &mut replacement_mapping,
484 "FILE_PATH",
485 path.to_string_lossy().into_owned(),
486 );
487
488 let mut reader = BenchmarkFileReader::new(path, replacement_mapping)?;
489 let mut line = String::with_capacity(1024);
490 let mut reader_result = reader.read_line(&mut line);
491
492 while let Some(result) = reader_result {
493 match result {
494 Ok(_) => {
495 if !is_blank_or_comment_line(&line) {
496 // boxing required because of recursion
497 Box::pin(self.process_line(ctx, &mut reader, &mut line)).await?;
498 }
499 }
500 Err(e) => return Err(e),
501 }
502
503 // Clear the line buffer for the next iteration.
504 line.clear();
505 reader_result = reader.read_line(&mut line);
506 }
507
508 Ok(())
509 }
510
511 async fn process_line(
512 &mut self,

Callers 3

newMethod · 0.80
process_templateMethod · 0.80
process_includeMethod · 0.80

Calls 7

insert_replacementFunction · 0.85
newFunction · 0.85
is_blank_or_comment_lineFunction · 0.85
read_lineMethod · 0.80
process_lineMethod · 0.80
cloneMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected