bubulalabu commented on issue #17379: URL: https://github.com/apache/datafusion/issues/17379#issuecomment-3393539925
I've a first draft for a potential solution. The approach stores parameter names in the `Signature` struct via `.with_parameter_names()`, then resolves named arguments to positional order during SQL planning before execution. This means no changes are needed to `ScalarFunctionArgs` or the physical execution layer. The implementation works for all fixed-arity signatures (Exact, Uniform, Any, Coercible, etc.) and validates that positional arguments come before named arguments, checks for unknown parameters, and prevents duplicates. It also improves error messages to show actual parameter names like `substr(str, start_pos, length)` instead of generic types like `substr(Any, Any, Any)`. Variadic functions aren't supported since they can't have fixed parameter names. Compared to @alamb's suggestion of passing names via ScalarFunctionArgs, this approach resolves names earlier during planning rather than passing them through to execution. UDF implementations don't need to change, they just receive arguments in the correct order. Compared to @mach-kernel's metadata approach, this approach validates immediately and keeps UDF code simpler, while the metadata approach offers more flexibility later on. Regarding @lukekim's observation about requiring updates to every UDF - this approach avoids that. Existing UDFs need no changes. Only UDFs that want named arguments add `.with_parameter_names()` to their signature construction. The function body itself remains unchanged. Please let me know what you think -- 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]
