You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Christopher Meier (Jira)" <ji...@apache.org> on 2022/09/29 18:30:00 UTC

[jira] [Created] (KAFKA-14268) When aggregating on a KGroupedStream allow an InitializerWithKey

Christopher Meier created KAFKA-14268:
-----------------------------------------

             Summary: When aggregating on a KGroupedStream allow an InitializerWithKey
                 Key: KAFKA-14268
                 URL: https://issues.apache.org/jira/browse/KAFKA-14268
             Project: Kafka
          Issue Type: Improvement
          Components: streams
            Reporter: Christopher Meier


Sometimes when aggregating on a KGroupedStream I would like to have an initial value which change depending on the key.

A workarround is to have a dummy value in the initializer which can be checked for and replaced in the aggregator, but that implies some performance loss caused by the check.

My proposal is to add yet another overload for {{aggregate}} which has instead of an {{Initializer}} an {{{}InitializerWithKey{}}}. The {{apply}} method of {{InitializerWithKey}} would have the key as input and the initial value as output.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)