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

Improve error messages for incorrect zero argument signatures #13881

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

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Dec 22, 2024

Which issue does this PR close?

Note this is a small improvement, before this PR:

Rationale for this change

As described on #13763

In version s 43.0.0 and earlier of DataFusion, a TypeSignature::Any(0) means your udf could be called with zero arguments:

SELECT my_udf();

However in version 44.0.0 you get a very confusing error that says zero arguments are not supported but then gives you a candidate function is the one it just said was not supported:

SELECT my_udf();

Error during planning: example_union does not support zero arguments. 
No function matches the given name and argument types 'my_udf()'. 
You might need to add explicit type casts.

Candidate functions:
example_union()

What changes are included in this PR?

Improve error message to direct people to nullary

Are these changes tested?

Yes by CI

Are there any user-facing changes?

return Ok(vec![]);
} else {
return plan_err!("{} does not support zero arguments.", func.name());
if type_signature.used_to_support_zero_arguments() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless this check is present, the error messages about TypeSignature::nullary are confusing as they are shown when the function is called with zero args, even if its signature requires something else (like exact signatures, etc)

@github-actions github-actions bot removed the sqllogictest SQL Logic Tests (.slt) label Dec 22, 2024
@alamb alamb mentioned this pull request Dec 22, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make migration to Signature::nullary in 44.0.0 easier / less confusing
1 participant