danny0405 commented on issue #1405: [CALCITE-2772] Support varargs UDF for scalar function URL: https://github.com/apache/calcite/pull/1405#issuecomment-536267854 > @danny0405 > > One example I found for varargs use case is when I tried to built ZetaSQL on top of Calcite. ZetaSQL has a `concat` function definition that accepts varargs [1]. So varargs will make `concat(string...)` implementable. I will agree `concat(string...)` can be written as a nested of binary `concat`, but it makes query more readable if need to concat more than 3 strings. > > [1] : https://github.com/google/zetasql/blob/master/docs/string_functions.md#concat Thanks for the example for `CONCAT`, in Calcite, we already have such function support as sql dialect [1], we declare it's operand types as `OperandTypes.repeat`, for repeated types arguments, we can support as this way, but if the arguments are different types but also variadic, maybe support freely variadic arguments is the right way to go. [1] https://github.com/apache/calcite/blob/2dc97e6723e1b5bf762540f87ffffb5cd1a848a1/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L255
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
