database-stream-processor icon indicating copy to clipboard operation
database-stream-processor copied to clipboard

Count operator

Open Kixiron opened this issue 3 years ago • 1 comments

We need to add a .count() operator that counts the number of values for any given key, e.g. (K, V).count() -> (K, isize)

Kixiron avatar Jul 24 '22 23:07 Kixiron

There are two forms of count we could support: count unique values V (count_distinct in DDlog) or count the sum of all weights of values associated with a key. The latter is linear, but the former seems to be what people more often want in practice. Both can be implemented using aggregate (a specialized implementation may be slightly more efficient, but I'm not sure it's worth it), but I agree that it needs to be packaged as a library method under src/operator.

ryzhyk avatar Jul 24 '22 23:07 ryzhyk