You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/12/17 13:21:11 UTC

Re: [PR] fix: allow to skip middle optional named parameters [datafusion]

Jefffrey commented on PR #19308:
URL: https://github.com/apache/datafusion/pull/19308#issuecomment-3665334719

   One thing I'm not understanding, is that this PR seems to imply all arguments are now optional and any can be skipped, filling in skipped arguments with scalar `NULL`; this means it is up to the UDFs themselves to check which arguments were provided (and define which are required), and assume that any scalar `NULL`s mean the argument was missing (even if the caller passed in a scalar `NULL` themself), correct?
   
   For example if we had a UDF like so:
   
   ```
   name: custom_udf
   signatures:
     - prefix: string, length: i64
     - prefix: string, suffix: string, length: i64
   ```
   
   Technically here `suffix` is optional, and when calling the function if we call it two 2 arguments (string & i64) then we'd know that only 2 arguments were provided and the implementation of the UDF can branch based on that. However if we call with named arguments for `prefix` and `length` but still omit `suffix`:
   
   ```sql
   custom_udf(prefix => 'a', length => 1)
   ```
   
   We'd always have 3 arguments provided because `suffix` gets filled with null.
   
   - Technically I think this code wouldn't work on current main anyway, now that I think of it; though it would just cause an error


-- 
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-unsubscribe@datafusion.apache.org

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


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