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

Method new

benchmarks/src/sql_benchmark.rs:73–105  ·  view source on GitHub ↗
(
        ctx: &SessionContext,
        full_path: impl AsRef<Path>,
        benchmark_directory: impl AsRef<Path>,
    )

Source from the content-addressed store, hash-verified

71
72impl SqlBenchmark {
73 pub async fn new(
74 ctx: &SessionContext,
75 full_path: impl AsRef<Path>,
76 benchmark_directory: impl AsRef<Path>,
77 ) -> Result<Self> {
78 let full_path = full_path.as_ref();
79 let benchmark_directory = benchmark_directory.as_ref();
80 let group_name = parse_group_from_path(full_path, benchmark_directory);
81 let mut bm = Self {
82 name: String::new(),
83 group: group_name,
84 subgroup: String::new(),
85 benchmark_path: full_path.to_path_buf(),
86 replacement_mapping: HashMap::new(),
87 expect: vec![],
88 queries: HashMap::new(),
89 result_queries: vec![],
90 assert_queries: vec![],
91 is_loaded: false,
92 last_results: None,
93 echo: vec![],
94 };
95 insert_replacement(
96 &mut bm.replacement_mapping,
97 "BENCHMARK_DIR",
98 benchmark_directory.to_string_lossy().into_owned(),
99 );
100
101 let path = bm.benchmark_path.clone();
102 bm.process_file(ctx, &path).await?;
103
104 Ok(bm)
105 }
106
107 /// Initializes the benchmark by executing `load` and `init` queries.
108 ///

Callers

nothing calls this directly

Calls 9

parse_group_from_pathFunction · 0.85
newFunction · 0.85
insert_replacementFunction · 0.85
process_fileMethod · 0.80
readMethod · 0.80
as_refMethod · 0.45
cloneMethod · 0.45
intoMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected