You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/12/14 17:05:36 UTC
[PR] Minor: Improve error handling in sqllogictest runner [arrow-datafusion]
alamb opened a new pull request, #8544:
URL: https://github.com/apache/arrow-datafusion/pull/8544
## Which issue does this PR close?
Closes https://github.com/apache/arrow-datafusion/issues/8541 (I think)
## Rationale for this change
@andygrove got an error when running sqllogictest, which I think was something related to his system setup (e.g. there was some filesystem error) but the error message was unhelpful
## What changes are included in this PR?
1. Added error handling rather than `panic`
## Before this PR
We get a somewhat unhelpful panic message about "Readable directory"
```
andrewlamb@Andrews-MacBook-Pro:~/Software/arrow-datafusion$ cargo test --test sqllogictests
Finished test [unoptimized + debuginfo] target(s) in 0.13s
Running bin/sqllogictests.rs (target/debug/deps/sqllogictests-a4acaa02cc91a4e3)
thread 'main' panicked at datafusion/sqllogictest/bin/sqllogictests.rs:264:14:
Readable directory: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests`
```
## After this PR
The error I think is quite a but clearer
```
andrewlamb@Andrews-MacBook-Pro:~/Software/arrow-datafusion$ cargo test --test sqllogictests
Compiling datafusion-sqllogictest v34.0.0 (/Users/andrewlamb/Software/arrow-datafusion/datafusion/sqllogictest)
Finished test [unoptimized + debuginfo] target(s) in 0.94s
Running bin/sqllogictests.rs (target/debug/deps/sqllogictests-a4acaa02cc91a4e3)
Error: Execution("Error reading directory \"test_files/\": No such file or directory (os error 2)")
error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests`
Caused by:
process didn't exit successfully: `/Users/andrewlamb/Software/arrow-datafusion/target/debug/deps/sqllogictests-a4acaa02cc91a4e3` (exit status: 1)
```
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
3. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve error handling in sqllogictest runner [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve error handling in sqllogictest runner [arrow-datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #8544:
URL: https://github.com/apache/arrow-datafusion/pull/8544#issuecomment-1856401018
I tried this out, but of course, I can no longer reproduce the issue :disappointed:
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Improve error handling in sqllogictest runner [arrow-datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #8544:
URL: https://github.com/apache/arrow-datafusion/pull/8544
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org