alamb commented on a change in pull request #8463:
URL: https://github.com/apache/arrow/pull/8463#discussion_r507106463
##########
File path: rust/datafusion/tests/sql.rs
##########
@@ -930,14 +930,20 @@ fn register_alltypes_parquet(ctx: &mut ExecutionContext) {
/// Execute query and return result set as 2-d table of Vecs
/// `result[row][column]`
async fn execute(ctx: &mut ExecutionContext, sql: &str) -> Vec<Vec<String>> {
- let plan = ctx.create_logical_plan(&sql).unwrap();
+ let msg = format!("Creating logical plan for '{}'", sql);
+ let plan = ctx.create_logical_plan(&sql).expect(&msg);
Review comment:
I am not quite sure what you are suggesting here @jorgecarleitao -- I
can revert these changes to `execute` if they are too confusing
Perhaps you suggesting I rewrite `execute` like:
```rust
/// Execute query and return result set as 2-d table of Vecs
/// `result[row][column]`
async fn execute(ctx: &mut ExecutionContext, sql: &str) ->
Result<Vec<Vec<String>>> {
let plan = ctx.create_logical_plan(&sql)?
let logical_schema = plan.schema();
....
result_vec(&results)
}
```
? If I did so, that would require changing most of the other `#[test]`
functions in this file -- which I would prefer not to do in this PR (I could do
it in a subsequent one if you like)
The reason I added these messages was so that I could get more context of
where the tests were failing. For example, without these changes, failures
generate an error like:
```
---- query_on_string_dictionary stdout ----
thread 'query_on_string_dictionary' panicked at 'called `Result::unwrap()`
on an `Err` value: General("\'Dictionary(Int32, Utf8) = Utf8\' can\'t be
evaluated because there isn\'t a common type to coerce the types to")',
datafusion/tests/sql.rs:940:16
```
But with these changes, then the actual error message is displayed:
```
---- query_on_string_dictionary stdout ----
thread 'query_on_string_dictionary' panicked at 'Creating physical plan for
'SELECT * FROM test WHERE d1 = 'three'': Projection: #d1
Filter: #d1 Eq Utf8("three")
TableScan: test projection=Some([0]): General("\'Dictionary(Int32, Utf8)
= Utf8\' can\'t be evaluated because there isn\'t a common type to coerce the
types to")', datafusion/tests/sql.rs:942:16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]