Skip to content

Make Diagnostic easy/convinient to attach by using macro and avoiding map_err #15796

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 3 commits into from
Apr 24, 2025

Conversation

logan-keede
Copy link
Contributor

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

Which issue does this PR close?

this actually gives me an idea that `err!` should support diagnostics as optional param, so we can remove extra `map_err`

Originally posted by @comphead in #15680 (comment)

  • Closes #.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sql SQL Planner common Related to common crate labels Apr 21, 2025
Diagnostic::new_error(format!("Invalid function '{name}'"), span);
diagnostic
.add_note(format!("Possible function '{}'", suggested_func_name), None);
plan_err!("Invalid function '{name}'.\nDid you mean '{suggested_func_name}'?"; diag=diagnostic)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to use ; which is a bit weird, but works, is this acceptable @comphead?

Copy link
Contributor

Choose a reason for hiding this comment

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

that would be not very obvious it is true.

@logan-keede logan-keede marked this pull request as ready for review April 21, 2025 19:38
@comphead
Copy link
Contributor

@logan-keede please run the planner tests to check if this change affects planner performance, we got some experience in the past #7522

@logan-keede
Copy link
Contributor Author

logan-keede commented Apr 23, 2025

@logan-keede please run the planner tests to check if this change affects planner performance, we got some experience in the past #7522
using

cargo bench --bench sql_planner

bench.txt
TLDR:- I got two regressions in physical_plan_clickbench_q46 and physical_plan_clickbench_q42, I ran them again separately, but they did not turn out to be regression again.

UPD: I ran them again a couple of times and they seem to be giving variable results. This pattern seems to be persisting over main branch too. so, it probably should not be a blocker.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @logan-keede

@comphead comphead merged commit 8f5158a into apache:main Apr 24, 2025
27 checks passed
nirnayroy pushed a commit to nirnayroy/datafusion that referenced this pull request May 2, 2025
…ng `map_err` (apache#15796)

* First Step

* Final Step?

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

Successfully merging this pull request may close these issues.

2 participants