To efficiently process data from IoT networks, current SPEs commonly centralize raw data from distributed sensors into a single data center, and then the SPEs process data into their computation cluster. Therefore, all raw data produced by sensors are required to be collected through the network to the data center, which leads to unnecessary network costs and high latency. The most common way for current SPEs to process an unbounded stream is to window the input data into fixed-size windows and then process each of those windows separately . Depending on different queries, SPEs define windows with different window measures, window types, and window aggregation functions, which are needed to be processed by different approaches. Currently, all time-based windows, including tumbling window, sliding window, and session window, are able to be processed based on distributed aggregation efficiently. However, the counting window, which is based on count measure doesn’t work well with distributed aggregation. When processing counting windows, system only can perform centralized aggregation instead of distributed aggregation due to local nodes are not able to create and end counting windows locally. So trying to create a counting window on local node, and predicting the window end of this kind of window can enable system process counting window with distributed aggregation, which can reduce computational resource consumption and improve performance.