resolve_function_arguments

Function resolve_function_arguments 

Source
pub fn resolve_function_arguments(
    param_names: &[String],
    args: Vec<Expr>,
    arg_names: Vec<Option<String>>,
) -> Result<Vec<Expr>>
Expand description

Resolves function arguments, handling named and positional notation.

This function validates and reorders arguments to match the function’s parameter names when named arguments are used.

§Rules

  • All positional arguments must come before named arguments
  • Named arguments can be in any order after positional arguments
  • Parameter names follow SQL identifier rules: unquoted names are case-insensitive (normalized to lowercase), quoted names are case-sensitive
  • No duplicate parameter names allowed

§Arguments

  • param_names - The function’s parameter names in order
  • args - The argument expressions
  • arg_names - Optional parameter name for each argument

§Returns

A vector of expressions in the correct order matching the parameter names

§Examples

Given parameters ["a", "b", "c"]
And call: func(10, c => 30, b => 20)
Returns: [Expr(10), Expr(20), Expr(30)]