Description
Currently KTable aggregation takes a selector used for selecting the aggregate key.and an aggregator for aggregating the values with the same selected key, which makes the function a little bit "heavy":
table.groupBy(initializer, adder, substractor, selector, /* optional serde*/);
It is better to extract the selector in a separate groupBy function such that
KTableGrouped KTable#groupBy(selector);
KTable KTableGrouped#aggregate(initializer, adder, substractor, /* optional serde*/);
Note that "KTableGrouped" only have APIs for aggregate and reduce, and none else. So users have to follow the pattern below:
table.groupBy(...).aggregate(...);
This pattern is more natural for users who are familiar with SQL / Pig or Spark DSL, etc.