Click to copy

• Reviewed for ksqlDB 0.29

How to Use Aggregation Functions in ksqlDB

Aggregation functions put several rows of data together. They do this by applying a certain rule. For example, the MAX function will get the maximum value from all the values within a group.

In ksqlDB, aggregation functions need to be used in combination with the GROUP BY clause.

How to find them

To find out what aggregation functions are available, list all the functions and look at the ones marked with the AGGREGATE category.

Function Name         | Category
--------------------------------------------
 AVG                   | AGGREGATE
 COLLECT_LIST          | AGGREGATE
 COLLECT_SET           | AGGREGATE
 COUNT                 | AGGREGATE
 COUNT_DISTINCT        | AGGREGATE
 EARLIEST_BY_OFFSET    | AGGREGATE
 HISTOGRAM             | AGGREGATE
 LATEST_BY_OFFSET      | AGGREGATE
 MAX                   | AGGREGATE
 MIN                   | AGGREGATE
 STDDEV_SAMP           | AGGREGATE
 STDDEV_SAMPLE         | AGGREGATE
 SUM                   | AGGREGATE
 SUM_LIST              | AGGREGATE
 TOPK                  | AGGREGATE
 TOPKDISTINCT          | AGGREGATE
Discover what readers are saying
topictale
Get easy to digest how-tos on ksqlDB
Sign up
Please read our Privacy Policy to understand how we protect and manage your data.
You may also like