Skip to content

chore: Attach Diagnostic to "function x does not exist" error #14849

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

Merged
merged 4 commits into from
Feb 26, 2025

Conversation

onlyjackfrost
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

well explained in the issue.

What changes are included in this PR?

This PR attaches Diagnostic with the "function x does not exist" error.
Get the span of function from sql-parser, then attach to Diagnostic after transformation.

Are these changes tested?

yes, unit test was added.

@github-actions github-actions bot added the sql SQL Planner label Feb 24, 2025
Copy link
Contributor

@eliaperantoni eliaperantoni left a comment

Choose a reason for hiding this comment

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

Looks great!

let mut diagnostic =
Diagnostic::new_error(format!("Invalid function '{name}'"), span);
diagnostic.add_note(
format!("possible function {}", suggested_func_name),
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this should be uppercase? Considering it's a message seen by an end user and not a programmatically consumed string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

delivered in 8441bb8

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.

Thanks @onlyjackfrost and @eliaperantoni

I think @eliaperantoni 's suggestion about message is a good one, but otherwise this one looks good to go to me

@alamb alamb merged commit a49d543 into apache:main Feb 26, 2025
24 checks passed
@alamb
Copy link
Contributor

alamb commented Feb 26, 2025

🚀 -- thanks again @onlyjackfrost and @eliaperantoni

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 "function x does not exist" error
3 participants