[
https://issues.apache.org/jira/browse/KAFKA-3337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Guozhang Wang updated KAFKA-3337:
---------------------------------
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":
{code}
table.groupBy(initializer, adder, substractor, selector, /* optional serde*/);
{code}
It is better to extract the selector in a separate groupBy function such that
{code}
KTableGrouped KTable#groupBy(selector);
KTable KTableGrouped#aggregate(initializer, adder, substractor, /* optional
serde*/);
{code}
Note that "KTableGrouped" only have APIs for aggregate and reduce, and none
else. So users have to follow the pattern below:
{code}
table.groupBy(...).aggregate(...);
{code}
This pattern is more natural for users who are familiar with SQL / Pig or Spark
DSL, etc.
was:
Currently KTable aggregation takes a selector and an aggregator, which makes
the function a little bit "heavy". It is better to extract the selector in a
separate groupBy function such that
{code}
table.groupBy(selector).aggregate(aggregator);
{code}
> Extract selector as a separate groupBy operator for KTable aggregations
> -----------------------------------------------------------------------
>
> Key: KAFKA-3337
> URL: https://issues.apache.org/jira/browse/KAFKA-3337
> Project: Kafka
> Issue Type: Sub-task
> Reporter: Guozhang Wang
> Labels: newbie++
> Fix For: 0.10.1.0
>
>
> 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":
> {code}
> table.groupBy(initializer, adder, substractor, selector, /* optional serde*/);
> {code}
> It is better to extract the selector in a separate groupBy function such that
> {code}
> KTableGrouped KTable#groupBy(selector);
> KTable KTableGrouped#aggregate(initializer, adder, substractor, /* optional
> serde*/);
> {code}
> Note that "KTableGrouped" only have APIs for aggregate and reduce, and none
> else. So users have to follow the pattern below:
> {code}
> table.groupBy(...).aggregate(...);
> {code}
> This pattern is more natural for users who are familiar with SQL / Pig or
> Spark DSL, etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)