You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Jon Yeargers <jo...@cedexis.com> on 2016/12/05 16:42:53 UTC
Understanding windowed aggregations
Im creating aggregated values as follows:
kStream.groupByKey.aggregate( ... ,TimeWindows.of(20 * 60 *
1000L).advanceBy(60 * 1000L), ...);
As I process each aggregate Im storing the current system clock time in the
aggregated record.
Im watching the aggregates come through with a subsequent '.forEach()'.
My assumption would be that an aggregate would occur when the time for a
new value falls between the start and end of a given window. Instead Im
seeing all values happen outside the expected range (Windowed.start() ->
Windowed.end())
Am I really confused about how this works?
Re: Understanding windowed aggregations
Posted by "Matthias J. Sax" <ma...@confluent.io>.
By default, Kafka Streams uses *event-time* and not *system-time* to
assign records to windows. That's why you observe this.
Please have look here and follow up if you have further question:
http://docs.confluent.io/current/streams/concepts.html#time
-Matthias
On 12/5/16 8:42 AM, Jon Yeargers wrote:
> Im creating aggregated values as follows:
>
> kStream.groupByKey.aggregate( ... ,TimeWindows.of(20 * 60 *
> 1000L).advanceBy(60 * 1000L), ...);
>
> As I process each aggregate Im storing the current system clock time in the
> aggregated record.
>
> Im watching the aggregates come through with a subsequent '.forEach()'.
>
> My assumption would be that an aggregate would occur when the time for a
> new value falls between the start and end of a given window. Instead Im
> seeing all values happen outside the expected range (Windowed.start() ->
> Windowed.end())
>
> Am I really confused about how this works?
>