You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "nyingping (Jira)" <ji...@apache.org> on 2022/07/26 03:26:00 UTC

[jira] [Created] (FLINK-28681) The number of windows allocated by sliding windows is inaccurate, when the window length is irregular

nyingping created FLINK-28681:
---------------------------------

             Summary: The number of windows allocated by sliding windows is inaccurate, when the window length is irregular
                 Key: FLINK-28681
                 URL: https://issues.apache.org/jira/browse/FLINK-28681
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Runtime
    Affects Versions: 1.15.1
            Reporter: nyingping


In assignWindows, the initial length of the list of Windows is determined by '(int) (size/slide)'.
{code:java}
List<TimeWindow> windows = new ArrayList<>((int) (size / slide)) {code}
This calculation is not accurate when the sliding window length is irregular.

For example, if the size is 10 and the slide is 3, '(int) (size/slide)' gives 3, but the final number of Windows is 4.

 

Although this does not affect functionality.But I think it would be better.
{code:java}
int len = (int) Math.ceil((double) (size / slide));
List windows = new ArrayList<>(len); {code}
 



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