You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Shivfun99 (via GitHub)" <gi...@apache.org> on 2026/01/18 14:40:26 UTC
[PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Shivfun99 opened a new pull request, #19873:
URL: https://github.com/apache/datafusion/pull/19873
### What this does
Enhances the SQL planner error message when a referenced table is not found by attaching a clearer diagnostic instead of a generic error.
### Why
This improves developer UX by making it easier to understand why a query failed and where the issue occurred in the SQL span.
### Changes
- Wrapped missing-table errors with a structured Diagnostic
- Preserved existing planner behavior
- Added better error context for SQL users
### Testing
- Ran `cargo test -p datafusion-sql`
- Manually tested missing table scenarios in DataFusion CLI
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #19873:
URL: https://github.com/apache/datafusion/pull/19873#issuecomment-3765480148
Is there a clear before & after test case to reference here? Best I can tell, this PR essentially only does this:
```diff
-format!("table '{}' not found", table_ref)
+format!("table '{}' not found", table_ref.table().to_string())
```
We already had the diagnostics, so I'm struggling to understand what exactly this PR is trying to fix/improve.
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #19873:
URL: https://github.com/apache/datafusion/pull/19873#issuecomment-3765450273
Is there an example of what this improved error looks like compared to the original version?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Shivfun99 (via GitHub)" <gi...@apache.org>.
Shivfun99 commented on PR #19873:
URL: https://github.com/apache/datafusion/pull/19873#issuecomment-3765471105
> Is there an example of what this improved error looks like compared to the original version?
The planner now attaches a structured diagnostic with SQL span context:
Error: table 'userz' not found
┌─ SQL
│
1 │ SELECT * FROM userz;
│ ^^^^^
│
= Did you mean: users?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Shivfun99 (via GitHub)" <gi...@apache.org>.
Shivfun99 commented on PR #19873:
URL: https://github.com/apache/datafusion/pull/19873#issuecomment-3765547252
> Is there a clear before & after test case to reference here? Best I can tell, this PR essentially only does this:
>
> ```diff
> -format!("table '{}' not found", table_ref)
> +format!("table '{}' not found", table_ref.table().to_string())
> ```
>
> We already had the diagnostics, so I'm struggling to understand what exactly this PR is trying to fix/improve.
Thanks for the feedback — that’s fair.
The main intent here is to keep the primary error string aligned with how users write SQL, by using the bare table name (`table_ref.table()`) rather than the full `TableReference` display (which can include schema/catalog qualifiers). This makes the error message and any follow-up suggestions easier to read and more consistent with the input query.
To make the improvement explicit, I’m happy to add a small regression test. For example:
Query:
SELECT * FROM userz;
Before:
Error: table 'public.userz' not found
After:
Error: table 'userz' not found
(with the diagnostic span preserved)
If that direction makes sense, I can push a test in `datafusion/sql/tests` to assert the bare-name behavior.
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #19873:
URL: https://github.com/apache/datafusion/pull/19873#issuecomment-3766290390
I'm not sure there is a clear motivating use case to this PR, and I am quite hesitant with it overall given the original PR body is incorrect in what it describes this PR does and only after my review was a comment added to properly describe what this PR does. Was this LLM generated?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve error message for missing tables with clearer diagnostics [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed pull request #19873: Improve error message for missing tables with clearer diagnostics
URL: https://github.com/apache/datafusion/pull/19873
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org