You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "eliaperantoni (via GitHub)" <gi...@apache.org> on 2025/02/03 12:10:17 UTC
[I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
eliaperantoni opened a new issue, #14436:
URL: https://github.com/apache/datafusion/issues/14436
### Is your feature request related to a problem or challenge?
For a query like:
```sql
SELECT * FROM users a, users a
```
The only message that the end user of an application built atop of DataFusion sees is:
```
Schema error: Schema contains duplicate qualified field name a.id
```
Similarly, for:
```sql
WITH cte AS (SELECT 1 AS col), cte AS (SELECT 2 AS col) SELECT 1
```
We get:
```
Error during planning: WITH query name "cte" specified more than once
```
We want to provide a richer message that _references and highlights locations in the original SQL query_, and contextualises and helps the user understand the error. In the end, it would be possible to display errors in a fashion akin to what was enabled by #13664 for some errors:

See #14429 for more information.
### Describe the solution you'd like
Attach a well crafted `Diagnostic` to the `DataFusionError`, building on top of the foundations laid in #13664. See #14429 for more information.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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.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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "vegarsti (via GitHub)" <gi...@apache.org>.
vegarsti commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-3128243457
Take
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "zjregee (via GitHub)" <gi...@apache.org>.
zjregee commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-2662385430
Sorry for the delay, I will start and finish it in the next few days.
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "haochunchang (via GitHub)" <gi...@apache.org>.
haochunchang commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-6059733268
The latest related PR is https://github.com/apache/datafusion/pull/20720 which had review feedback that was not yet addressed.
I can pick it up and try addressing reviewer's feedback.
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "vegarsti (via GitHub)" <gi...@apache.org>.
vegarsti commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-3131087119
`DFParser::parse_sql(query)` returns an `Ok` for both examples in the OP 🤔 Did something change in the meantime or am I missing something? My test is
```
#[test]
fn test_ambiguous_with_diagnostic() -> Result<()> {
// let query = "SELECT * FROM users a, users a";
let query = "WITH cte AS (SELECT 1 AS col), cte AS (SELECT 2 AS col) SELECT 1";
let spans = get_spans(query);
match DFParser::parse_sql(query) {
Ok(stmts) => {
panic!("expected error, got {:?}", stmts);
}
Err(err) => match err.diagnostic() {
Some(diag) => {
let diag = diag.clone();
assert_snapshot!(diag.message, @"TODO");
Ok(())
}
None => {
panic!("expected diagnostic")
}
},
}
}
```
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "haochunchang (via GitHub)" <gi...@apache.org>.
haochunchang commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-6059738325
take
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-2634527995
I think this is a good first issue as the need is clear and the tests in https://github.com/apache/datafusion/blob/85fbde2661bdb462fc498dc18f055c44f229604c/datafusion/sql/tests/cases/diagnostic.rs are well structured for extension.
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "zjregee (via GitHub)" <gi...@apache.org>.
zjregee commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-2635780992
take
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "eliaperantoni (via GitHub)" <gi...@apache.org>.
eliaperantoni commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-2656883539
Hey @zjregee how is it going with this ticket :) Can I help with anything?
--
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: [I] Attach `Diagnostic` to "duplicate table name" error [datafusion]
Posted by "amitvijapur (via GitHub)" <gi...@apache.org>.
amitvijapur commented on issue #14436:
URL: https://github.com/apache/datafusion/issues/14436#issuecomment-4191635525
Hi, I'd like to work on this. First-time contributor — will follow the pattern from PR #15209.
--
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