eliaperantoni commented on issue #13662: URL: https://github.com/apache/datafusion/issues/13662#issuecomment-2523392024
> Datafusion supports backtraces to find where the problem happens in the first place [datafusion.apache.org/user-guide/crate-configuration.html#enable-backtraces](https://datafusion.apache.org/user-guide/crate-configuration.html#enable-backtraces) That's true, and I think it's an invaluable tool for debugging and developing DataFusion or software that relies on it. But in my opinion it's not really the best end user facing error reporting solution. - It's not really readable on its own (for end users, not developers) - Can't extract a nicer message from it - References DataFusion's source code locations, not the SQL queries' locations Take this trace: ``` 3: datafusion_common::error::DataFusionError::get_back_trace at /Users/eper/code/datafusion/datafusion/common/src/error.rs:410:30 4: datafusion_sql::utils::check_column_satisfies_expr at /Users/eper/code/datafusion/datafusion/sql/src/utils.rs:153:16 5: datafusion_sql::utils::check_columns_satisfy_exprs at /Users/eper/code/datafusion/datafusion/sql/src/utils.rs:141:18 6: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::aggregate at /Users/eper/code/datafusion/datafusion/sql/src/select.rs:807:9 7: datafusion_sql::select::<impl datafusion_sql::planner::SqlToRel<S>>::select_to_plan at /Users/eper/code/datafusion/datafusion/sql/src/select.rs:200:13 8: datafusion_sql::query::<impl datafusion_sql::planner::SqlToRel<S>>::query_to_plan at /Users/eper/code/datafusion/datafusion/sql/src/query.rs:55:28 9: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan_with_context_impl at /Users/eper/code/datafusion/datafusion/sql/src/statement.rs:220:40 10: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::sql_statement_to_plan at /Users/eper/code/datafusion/datafusion/sql/src/statement.rs:183:9 11: datafusion_sql::statement::<impl datafusion_sql::planner::SqlToRel<S>>::statement_to_plan at /Users/eper/code/datafusion/datafusion/sql/src/statement.rs:171:42 12: datafusion::execution::session_state::SessionState::statement_to_plan::{{closure}} at /Users/eper/code/datafusion/datafusion/core/src/execution/session_state.rs:560:9 13: datafusion::execution::session_state::SessionState::create_logical_plan::{{closure}} at /Users/eper/code/datafusion/datafusion/core/src/execution/session_state.rs:593:54 ``` The query was `SELECT name FROM users GROUP BY id`, so the error is that `name` must be in the `GROUP BY`. The closest hint we have from the backtrace is the call to `SqlToRel::aggregate` but that's it. With the changes that I'm contributing in #13664, the same query would produce diagnostics data that look like this: ``` (line 1, column 8) error: 'users.name' in projection does not appear in GROUP BY clause (line 1, column 33) note: GROUP BY clause is here (line 1, column 33) Help: Add 'users.name' to GROUP BY clause ``` -- 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]
