How to declare the signature of an aggregate function with variadic arguments #11672
Replies: 2 comments
-
Hi, @mbasmanova @Yuhta . Do you have any suggestions for this question? Can we define a variadic arguments aggregate function in velox? |
Beta Was this translation helpful? Give feedback.
-
@shenh062326 We haven't yet ran into a use case that requires variadic arguments for an aggregate function. I'm curious where aggregate functions you mentioned come from? What kind of system is using these?
One option to implement this might be using masked aggregation: count(1) filter (where col1 is not null and col2 is not null and ...) In principle, it should be possible to support variadic arguments for aggregate functions. Feel free to take a stub at adding that. |
Beta Was this translation helpful? Give feedback.
-
Currently we can add a scalar function with variadic arguments, https://facebookincubator.github.io/velox/develop/scalar-functions.html#variadic-arguments .
In some scenarios, we also need to support variadic arguments in aggregate functions. For example, we need a count(col1, col2, col3 ...) function to count the number of rows where each column is not null. Other similar variadic arguments aggregate functions include sequence_count, sequence_match, etc. But I'm not sure how to add variadic arguments aggregate functions, it will throw "Type doesn't exist: 'VARIADIC ANY'" in the following code.
Can anyone tell me how to define a variadic arguments aggregate function or is it not supported by velox?
Beta Was this translation helpful? Give feedback.
All reactions