alamb opened a new pull request, #13871:
URL: https://github.com/apache/datafusion/pull/13871

   ## Which issue does this PR close?
   
   - Closes https://github.com/apache/datafusion/issues/13763
   
   ## Rationale for this change
   
   As described on https://github.com/apache/datafusion/issues/13763
   
   In version s 43.0.0 and earlier of DataFusion, a `TypeSignature::Any(0)` 
means your udf could be called with zero arguments:
   ```sql
   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:
   
   ```sql
   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()
   ```
   
   I believe @jayzhan211  added this error to try and guide people to ensure 
people used the newly introduced `Signature::Nullary` (see 
https://github.com/apache/datafusion/issues/13763#issuecomment-2542609203)
   
   However, when I wrote some tests for this it turns out there are several 
other ways to represent 0 argument functions and only `Signature::Any(0)` 
errors like this, which I found very confusing
   
   ## What changes are included in this PR?
   1. Add tests showing various ways to call udfs with no arguments
   2. Update Signature::supports_zero_args
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   3. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to