Skip to content
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

Attach Diagnostic to "invalid function argument types" error #14431

Open
Tracked by #14429
eliaperantoni opened this issue Feb 3, 2025 · 8 comments · May be fixed by #14710
Open
Tracked by #14429

Attach Diagnostic to "invalid function argument types" error #14431

eliaperantoni opened this issue Feb 3, 2025 · 8 comments · May be fixed by #14710
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@eliaperantoni
Copy link
Contributor

eliaperantoni commented Feb 3, 2025

Is your feature request related to a problem or challenge?

For a query like:

SELECT sum('a')

The only message that the end user of an application built atop of DataFusion sees is:

Error during planning: Execution error: User-defined coercion failed with Execution("Sum not supported for Utf8") No function matches the given name and argument types 'sum(Utf8)'. You might need to add explicit type casts.
        Candidate functions:
        sum(UserDefined)

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

@eliaperantoni eliaperantoni added the enhancement New feature or request label Feb 3, 2025
@eliaperantoni eliaperantoni changed the title Attach Diagnostic to "invalid function argument types" error Attach Diagnostic to "invalid function argument types" error Feb 3, 2025
@dentiny
Copy link
Contributor

dentiny commented Feb 4, 2025

Hi I'm interested in this ticket. Could you please assign it to me?

If you think my progress slow, feel free to ping me any time, I will try to prioritize and expedite. Thank you!

@eliaperantoni
Copy link
Contributor Author

@dentiny Absolutely! Though I don't have the permissions to assign it to you, you can write take and the GitHub bot will

@dentiny
Copy link
Contributor

dentiny commented Feb 4, 2025

take

@alamb
Copy link
Contributor

alamb commented Feb 4, 2025

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.

@alamb alamb added the good first issue Good for newcomers label Feb 4, 2025
@eliaperantoni
Copy link
Contributor Author

Hey @dentiny how is it going with this ticket :) Can I help with anything?

@dentiny
Copy link
Contributor

dentiny commented Feb 14, 2025

Hi @eliaperantoni thanks for checking! I'm still playing around df these days, should be able to get sth by EOW, do you think it's ok for you?

@eliaperantoni
Copy link
Contributor Author

Hi @eliaperantoni thanks for checking! I'm still playing around df these days, should be able to get sth by EOW, do you think it's ok for you?

Absolutely! I'm here if you need any help :)

@dentiny dentiny linked a pull request Feb 17, 2025 that will close this issue
@dentiny
Copy link
Contributor

dentiny commented Feb 17, 2025

Checking the code, I found for "invalid argument type" error there're quite a few places we need to update;
I update only one of them in the PR, mainly want to make sure I don't mis-understand, could followup with other PRs later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants