kumarUjjawal commented on code in PR #25027:
URL: https://github.com/apache/datafusion/pull/25027#discussion_r3951004240
##########
datafusion/core/benches/sql_planner.rs:
##########
@@ -85,6 +85,29 @@ fn physical_plan(ctx: &SessionContext, rt: &Runtime, sql:
&str) {
}));
}
+/// Read the `q{N}.sql` query files from `dir`, starting at `q0.sql` and
+/// stopping at the first missing file.
+///
+/// This mirrors the discovery scheme used by the `dfbench clickbench` runner
+/// (see `get_query_sql` / `get_query_path` in `benchmarks/src/clickbench.rs`)
+/// so that newly added query files are picked up without changing this code.
+fn read_numbered_queries(dir: &str) -> Vec<String> {
+ let mut queries = Vec::new();
+ for q in 0.. {
+ let path = format!("{dir}q{q}.sql");
+ match std::fs::read_to_string(&path) {
+ Ok(sql) => queries.push(sql),
+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => break,
Review Comment:
Thanks @adriangb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]