Hi,

I suggest that Merger<K,V> should extend Aggregator<K,V,V>.
reason:
Both classes usually do very similar things. A merger takes two sessions and 
combines them, an aggregator takes an existing session and aggregates new 
values into it.
in some use cases it is actually the same thing, e.g.:
<null, log_event> -> .map() to <session_id,SingletonList<log_event>> -> 
.groupByKey().aggregate() to <session_id, List<log_event>>
In this case both merger and aggregator do the same thing: take two lists and 
combine them into one.
With the proposed change we could pass the Merger as both the merger and 
aggregator to the .aggregate() method and keep our business logic within one 
merger class.

Or in other words: The Merger is simply an Aggregator that happens to aggregate 
two objects of the same class.

I opened a ticket with KAFKA-5648? and a PR for this suggestion


Thoughts?


Clemens

Reply via email to