alamb commented on code in PR #8544:
URL: https://github.com/apache/arrow-datafusion/pull/8544#discussion_r1427002379
##########
datafusion/sqllogictest/bin/sqllogictests.rs:
##########
@@ -247,30 +247,45 @@ impl TestFile {
}
}
-fn read_test_files<'a>(options: &'a Options) -> Box<dyn Iterator<Item =
TestFile> + 'a> {
- Box::new(
- read_dir_recursive(TEST_DIRECTORY)
+fn read_test_files<'a>(
+ options: &'a Options,
+) -> Result<Box<dyn Iterator<Item = TestFile> + 'a>> {
+ Ok(Box::new(
+ read_dir_recursive(TEST_DIRECTORY)?
+ .into_iter()
.map(TestFile::new)
.filter(|f| options.check_test_file(&f.relative_path))
.filter(|f| f.is_slt_file())
.filter(|f| f.check_tpch(options))
.filter(|f| options.check_pg_compat_file(f.path.as_path())),
- )
+ ))
}
-fn read_dir_recursive<P: AsRef<Path>>(path: P) -> Box<dyn Iterator<Item =
PathBuf>> {
- Box::new(
- std::fs::read_dir(path)
- .expect("Readable directory")
Review Comment:
The point of this PR is to remove the `expect` in this line and the line
below
While I am sure we could retain the iterator nature of the previous
implementation, given we are talking about less than 30 files I think buffering
them in a Vec is perfectly acceptable and makes the error handling easier
--
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]