Require all zero argument UDFs use Signature::Nullary, improve error messages#13871
Closed
alamb wants to merge 9 commits intoapache:mainfrom
Closed
Require all zero argument UDFs use Signature::Nullary, improve error messages#13871alamb wants to merge 9 commits intoapache:mainfrom
Signature::Nullary, improve error messages#13871alamb wants to merge 9 commits intoapache:mainfrom
Conversation
alamb
commented
Dec 21, 2024
Signature::Any(0), and add tests for zero argumentsSignature::Any(0), and add tests for zero argument udfs
6def9f3 to
2f83cd0
Compare
…rgument functions - Updated the `Simple0ArgsScalarUDF` to utilize `Signature::nullary` instead of `Signature::exact`. - Modified tests to reflect the change in signature handling for zero-argument functions. - Enhanced error messages in type coercion functions to clarify the requirement for nullary signatures. - Cleaned up redundant checks and improved code readability in the type coercion logic. This change improves consistency in how zero-argument functions are defined and validated across the codebase.
Signed-off-by: Jay Zhan <jayzhan211@gmail.com>
Contributor
|
I update the fix here alamb#22 |
Require all zero argument UDFs use `Signature::Nullary`, improve error messages
Signature::Any(0), and add tests for zero argument udfsSignature::Nullary, improve error messages
Contributor
Author
|
Given there are a few more built in functions with exact, I think we should postpone this PR until next release (aka postpone merge for a few days) In the intervening time I will prepare a PR that just improves the error message for 43. Thank you for your help @jayzhan211 |
Contributor
Author
|
Here is a PR with just improvements to the error messages |
Contributor
Author
|
I don't have time to finish this work now. If anyone else wants to try and make progress, feel free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Signature::nullaryin 44.0.0 easier / less confusing #13763Rationale 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:
Also,
Signature::Exact(vec![])does work.What changes are included in this PR?
Are these changes tested?
Yes, now integration tests are added, and redundant unit tests removed
Are there any user-facing changes?