Variable arguments

Variable-argument functions and aggregates offer even more flexibility than generic-size arguments. With variable argument UDFs, UDAs, and UDTFs, you specify only the VARARGS keyword in the argument_type_list. Users can specify 0 - 64 input values of any supported data type as input arguments. For example, by using the greatest_value function from a previous section:
MYDB.SCHEMA(MYUSER)=> CREATE FUNCTION greatest_value(VARARGS) RETURNS 
INT64...

Within the body of the function, the code must process the input values and manage them as needed. For example, the function body should verify the data types of the input arguments and either cast or error out as applicable. You must design your UDX code to handle the local data type of the input values, such as managing Numeric32Val versus double data types. If you were hardcoding the input values, you can declare the input as func(double) and when invoked with a numeric, the system would cast it to double for you.

You can use variable argument signatures to create one function or aggregate that can be used for different combinations of input types. This simplifies the development of your UDFs, UDAs, and UDTFs and reduces the need to create overloaded definitions that do the same task for different types and numbers of arguments.