Skip to content

Attach Diagnostic to syntax errors #15680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

logan-keede
Copy link
Contributor

@logan-keede logan-keede commented Apr 10, 2025

Which issue does this PR close?

Rationale for this change

converting ParserError into DataFusionError to attach diagnostic through expected.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@logan-keede logan-keede marked this pull request as ready for review April 13, 2025 18:01
@logan-keede
Copy link
Contributor Author

cc @eliaperantoni

@logan-keede logan-keede changed the title WIP: Attach Diagnostic to syntax errors Attach Diagnostic to syntax errors Apr 13, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @logan-keede !

Is it possible to add a test for this feature, perhaps in

fn test_qualified_column_not_found() -> Result<()> {
let query = "SELECT /*a*/person.first_namex/*a*/ FROM person";
let spans = get_spans(query);
let diag = do_query(query);
assert_snapshot!(diag.message, @"column 'first_namex' not found in 'person'");
assert_eq!(diag.span, Some(spans["a"]));
Ok(())
}
?

@logan-keede
Copy link
Contributor Author

Thank you @logan-keede !

Is it possible to add a test for this feature, perhaps in

fn test_qualified_column_not_found() -> Result<()> {
let query = "SELECT /*a*/person.first_namex/*a*/ FROM person";
let spans = get_spans(query);
let diag = do_query(query);
assert_snapshot!(diag.message, @"column 'first_namex' not found in 'person'");
assert_eq!(diag.span, Some(spans["a"]));
Ok(())
}

?

Yes, I will do that. Thanks for the review!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attach Diagnostic to syntax errors
2 participants