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

Function get_query_sql

benchmarks/src/imdb/mod.rs:219–239  ·  view source on GitHub ↗

Get the SQL statements from the specified query file

(query: &str)

Source from the content-addressed store, hash-verified

217
218/// Get the SQL statements from the specified query file
219pub fn get_query_sql(query: &str) -> Result<Vec<String>> {
220 let possibilities = vec![
221 format!("queries/imdb/{query}.sql"),
222 format!("benchmarks/queries/imdb/{query}.sql"),
223 ];
224 let mut errors = vec![];
225 for filename in possibilities {
226 match fs::read_to_string(&filename) {
227 Ok(contents) => {
228 return Ok(contents
229 .split(';')
230 .map(|s| s.trim())
231 .filter(|s| !s.is_empty())
232 .map(|s| s.to_string())
233 .collect());
234 }
235 Err(e) => errors.push(format!("{filename}: {e}")),
236 };
237 }
238 plan_err!("invalid query. Could not find query: {:?}", errors)
239}

Callers 3

benchmark_queryMethod · 0.70
round_trip_logical_planFunction · 0.70
round_trip_physical_planFunction · 0.70

Calls 8

collectMethod · 0.80
trimMethod · 0.80
mapMethod · 0.45
filterMethod · 0.45
splitMethod · 0.45
is_emptyMethod · 0.45
to_stringMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…