You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2021/07/23 17:47:00 UTC

[jira] [Updated] (KAFKA-12839) SlidingWindow with timeDifference zero fails

     [ https://issues.apache.org/jira/browse/KAFKA-12839?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias J. Sax updated KAFKA-12839:
------------------------------------
    Description: 
Trying to use a sliding window with time-difference 0 (that is officially supported) fails with an exception and Kafka Stream crashes with

{{IllegalArgumentException: Window endMs must be greater than window startMs}}

The underlying issue is the usage of {{TimeWindow}} to represent the window what is incorrect.

{{TimeWindow}} is designed for hopping/tumbling windows with an inclusive lower and exclusive upper bound. Thus, the upper bound must be larger than the lower bound, because otherwise the window would have a negative size what is not allowed.

For sliding windows, we use include lower and upper bound though, and thus want to set upper and lower bound to be the same, what would still result in a window of size 1 (note that time-difference of 0 results in window size 1).

It seems we need to introduce a new {{SlidingWindow}} type.

Note, that for a non-zero time-difference, the window bounds are computed "correctly", however, {{TimeWindow}} is still an incorrect representation because it represents `[start,end)` instead of `[start,end]`.

 

KIP-765 [https://cwiki.apache.org/confluence/display/KAFKA/KIP-765%3A+Introduce+new+SlidingWindow+type+for+%5Bstart%2Cend%5D+time] 

  was:
Trying to use a sliding window with time-difference 0 (that is officially supported) fails with an exception and Kafka Stream crashes with

{{IllegalArgumentException: Window endMs must be greater than window startMs}}

The underlying issue is the usage of {{TimeWindow}} to represent the window what is incorrect.

{{TimeWindow}} is designed for hopping/tumbling windows with an inclusive lower and exclusive upper bound. Thus, the upper bound must be larger than the lower bound, because otherwise the window would have a negative size what is not allowed.

For sliding windows, we use include lower and upper bound though, and thus want to set upper and lower bound to be the same, what would still result in a window of size 1 (note that time-difference of 0 results in window size 1).

It seems we need to introduce a new {{SlidingWindow}} type.

Note, that for a non-zero time-difference, the window bounds are computed "correctly", however, {{TimeWindow}} is still an incorrect representation because it represents `[start,end)` instead of `[start,end]`.


> SlidingWindow with timeDifference zero fails
> --------------------------------------------
>
>                 Key: KAFKA-12839
>                 URL: https://issues.apache.org/jira/browse/KAFKA-12839
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Matthias J. Sax
>            Assignee: Luke Chen
>            Priority: Major
>              Labels: kip
>
> Trying to use a sliding window with time-difference 0 (that is officially supported) fails with an exception and Kafka Stream crashes with
> {{IllegalArgumentException: Window endMs must be greater than window startMs}}
> The underlying issue is the usage of {{TimeWindow}} to represent the window what is incorrect.
> {{TimeWindow}} is designed for hopping/tumbling windows with an inclusive lower and exclusive upper bound. Thus, the upper bound must be larger than the lower bound, because otherwise the window would have a negative size what is not allowed.
> For sliding windows, we use include lower and upper bound though, and thus want to set upper and lower bound to be the same, what would still result in a window of size 1 (note that time-difference of 0 results in window size 1).
> It seems we need to introduce a new {{SlidingWindow}} type.
> Note, that for a non-zero time-difference, the window bounds are computed "correctly", however, {{TimeWindow}} is still an incorrect representation because it represents `[start,end)` instead of `[start,end]`.
>  
> KIP-765 [https://cwiki.apache.org/confluence/display/KAFKA/KIP-765%3A+Introduce+new+SlidingWindow+type+for+%5Bstart%2Cend%5D+time] 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)