Recursively scans a directory and appends valid query benchmark files to the provided collection.
(&self, dir: &Path, queries: &mut Vec<SuiteQuery>)
| 179 | /// Recursively scans a directory and appends valid query benchmark files to |
| 180 | /// the provided collection. |
| 181 | fn scan_query_dir(&self, dir: &Path, queries: &mut Vec<SuiteQuery>) -> Result<()> { |
| 182 | let mut entries = read_dir_entries(dir, "benchmark query directory")?; |
| 183 | entries.sort_by_key(|entry| entry.file_name()); |
| 184 | |
| 185 | for entry in entries { |
| 186 | let path = entry.path(); |
| 187 | let file_type = entry.file_type().map_err(|e| { |
| 188 | DataFusionError::External( |
| 189 | format!( |
| 190 | "failed to read benchmark query entry type {}: {e}", |
| 191 | path.display() |
| 192 | ) |
| 193 | .into(), |
| 194 | ) |
| 195 | })?; |
| 196 | |
| 197 | if file_type.is_dir() { |
| 198 | self.scan_query_dir(&path, queries)?; |
| 199 | continue; |
| 200 | } |
| 201 | |
| 202 | if path |
| 203 | .extension() |
| 204 | .is_none_or(|extension| extension != "benchmark") |
| 205 | { |
| 206 | continue; |
| 207 | } |
| 208 | |
| 209 | let file_name = entry.file_name().to_string_lossy().into_owned(); |
| 210 | if let Some(id) = parse_query_file_name(&file_name) { |
| 211 | queries.push(SuiteQuery { |
| 212 | id, |
| 213 | file_name, |
| 214 | path, |
| 215 | }); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | Ok(()) |
| 220 | } |
| 221 | |
| 222 | /// Validates suite metadata that cannot be enforced by TOML deserialization. |
| 223 | fn validate(&self) -> Result<()> { |
no test coverage detected