kumarUjjawal commented on code in PR #25027:
URL: https://github.com/apache/datafusion/pull/25027#discussion_r3950798263


##########
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:
   A missing intermediate query will silently hides every later query. For 
example, if `q8.sql` disappears while `q9.sql` through `q13.sql` remain, this 
returns Q0–Q7 and the non-empty assertion passes
   
   Could we enumerate and numerically sort the `qN.sql` files, then assert that 
their numbers are contiguous?



-- 
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]

Reply via email to