Standardize UDF coercion error messages #20070
Open
+200
−142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
candidate functionssuggestions #15817 and Improve error messages when coercion fails #19004Rationale for this change
Current error message for calling functions with incorrect arguments isn't very user friendly. Some examples:
OneOfsignature, and we currently concatenate each error from each signature inside theOneOfresulting in a large error message that isn't very helpfulabs, which is niceCandidate functionswhich isn't very helpful (greatest(UserDefined)doesn't really help the user understand the available signatures since user defined is opaque)Contrast this with DuckDB:
Or Postgres:
It looks like they prefer to omit stating specific errors, and only give general advice; for DuckDB they list the available call types, for Postgres they omit this and leave it a simple error with only details on how it was called.
This PR looks into removing some of the word spam from error messages and tries to make them more consistent with each other.
What changes are included in this PR?
When a function call fails because no signatures match, the displayed error either:
coerce_typescall of the UDF (we omit candidate functions message)For example, user-defined:
For all other signatures:
Although it means we don't show a specific error anymore (see how
absno longer specifies it was because it received string instead of a numeric), I think this is an easier way to manage signature errors to be consistent for functions that have a single signature and those that areOneOftypes. It also aligns with DuckDB.Are these changes tested?
Yes.
Are there any user-facing changes?
Yes, error messages for failed function calls changes.