bubulalabu commented on PR #19308:
URL: https://github.com/apache/datafusion/pull/19308#issuecomment-3666626416
Hey @Jefffrey, thanks for having a look.
What actually happens: This PR allows skipping any parameter with named
arguments by filling it with NULL. The UDF receives that NULL and can't
distinguish between explicit NULL vs skipped parameter. All three are identical:
```sql
custom_udf('a', NULL, 1)
custom_udf(prefix=>'a', suffix=>NULL, length=>1)
custom_udf(prefix=>'a', length=>1)
```
All three pass 3 arguments with suffix=NULL to the function.
Regarding your OneOf example: That wouldn't work well with parameter_names
regardless of this PR - shorter signatures must be prefixes of longer ones
(each position means the same thing across variants). Your example has position
1 meaning different things (length vs suffix).
On NULL compatibility: NULL is universally accepted by all type signatures
in DataFusion - the signature matching logic explicitly treats `DataType::Null`
as compatible with any type. So signature validation will always pass with the
NULL-filled arguments. All function are expected to handle NULLs.
The function implementation decides how to handle that NULL (skip it, error,
return NULL, etc.). The PR just sets all missing previous parameters NULL under
the hood instead of requiring consecutive filling.
Please have a look at the most recent commit where I stress test your
concerns.
Does that clarify things?
I will update the title and description of the PR
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]